repo_name
stringlengths 5
122
| path
stringlengths 3
232
| text
stringlengths 6
1.05M
|
|---|---|---|
resetius/graphtoys
|
lib/object.h
|
<gh_stars>0
#pragma once
struct DrawContext {
float ratio;
float time;
int w;
int h;
};
struct Object {
void (*draw)(struct Object*, struct DrawContext* );
void (*free)(struct Object*);
void (*move_left)(struct Object*, int mods);
void (*move_right)(struct Object*, int mods);
void (*move_up)(struct Object*, int mods);
void (*move_down)(struct Object*, int mods);
void (*zoom_in)(struct Object*, int mods);
void (*zoom_out)(struct Object*, int mods);
void (*mode)(struct Object*);
};
struct ObjectVec {
struct Object** objs;
int cap;
int size;
};
void ovec_free(struct ObjectVec* );
void ovec_add(struct ObjectVec*, struct Object*);
struct Object* ovec_get(struct ObjectVec*, int index);
|
resetius/graphtoys
|
test/gltf.c
|
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <lib/formats/gltf.h>
static void get_config_fname(char* out, int size, const char* dir, const char* config) {
memset(out, 0, size);
strncpy(out, dir, size-256);
strcat(out, config);
}
static void test_cube(void** state) {
char buf[10240];
get_config_fname(buf, sizeof(buf), (char*)*state, "assets/khr/scenes/cube.gltf");
struct Gltf gltf;
gltf_ctor(&gltf, buf);
assert_int_equal(gltf.n_nodes, 1);
assert_int_equal(gltf.n_meshes, 1);
assert_int_equal(gltf.n_materials, 1);
assert_string_equal(gltf.materials[0].name, "Material");
assert_int_equal(gltf.n_buffers, 1);
assert_int_equal(gltf.buffers[0].size, 1188);
assert_int_equal(gltf.n_accessors, 4);
gltf_dtor(&gltf);
}
static void test_teapot(void** state) {
char buf[10240];
get_config_fname(buf, sizeof(buf), (char*)*state, "assets/khr/scenes/teapot.gltf");
struct Gltf gltf;
gltf_ctor(&gltf, buf);
assert_int_equal(gltf.n_nodes, 1);
assert_int_equal(gltf.n_meshes, 1);
assert_int_equal(gltf.n_materials, 1);
assert_string_equal(gltf.materials[0].name, "Material");
assert_int_equal(gltf.n_buffers, 1);
assert_int_equal(gltf.buffers[0].size, 167328);
assert_int_equal(gltf.n_accessors, 3);
gltf_dtor(&gltf);
}
static void test_sponza(void** state) {
char buf[10240];
get_config_fname(buf, sizeof(buf), (char*)*state, "assets/khr/scenes/sponza/Sponza01.gltf");
struct Gltf gltf;
gltf_ctor(&gltf, buf);
assert_int_equal(gltf.n_nodes, 0x1b);
assert_int_equal(gltf.n_meshes, 0x19);
assert_int_equal(gltf.n_materials, 0x19);
assert_string_equal(gltf.materials[0].name, "flagpole");
assert_int_equal(gltf.n_buffers, 1);
assert_int_equal(gltf.buffers[0].size, 0xa37e74);
assert_int_equal(gltf.n_accessors, 0x7d);
gltf_dtor(&gltf);
}
int main(int argc, char** argv) {
char dir[10240];
if (argc > 1) {
strncpy(dir, argv[1], sizeof(dir)-1);
strcat(dir, "/");
} else {
char* pos;
strncpy(dir, argv[0], sizeof(dir)-10);
pos = strrchr(dir, '/');
if (pos) {
*pos = 0;
}
strcat(dir, "/../");
}
const struct CMUnitTest tests[] = {
cmocka_unit_test_prestate(test_cube, dir),
cmocka_unit_test_prestate(test_teapot, dir),
cmocka_unit_test_prestate(test_sponza, dir)
};
return cmocka_run_group_tests(tests, NULL, NULL);
}
|
resetius/graphtoys
|
tools/rcc.c
|
<filename>tools/rcc.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void usage(char* name) {
printf("%s text.txt [-o output_name] [--strip prefix] [-q]\n", name);
}
int main(int argc, char** argv) {
int i;
char* input = NULL;
char* output = NULL;
char* varname = NULL;
FILE* fin = NULL;
FILE* fout = NULL;
char* dot;
int ch;
int count = 0;
int size = 0;
char* prefix = NULL;
int quiet = 0;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-o")) {
if (i == argc - 1) {
usage(argv[0]);
return -1;
}
output = strdup(argv[++i]);
} else if (!strcmp(argv[i], "--strip")) {
if (i == argc - 1) {
usage(argv[0]);
return -1;
}
prefix = argv[++i];
} else if (!strcmp(argv[i], "-q")) {
quiet = 1;
} else {
input = strdup(argv[i]);
}
}
if (!input) {
usage(argv[0]);
return -1;
}
if (!output) {
output = malloc(strlen(input) + 20);
strcpy(output, input);
strcat(output, "_gen.c");
}
if (!quiet) {
fprintf(stderr, "generating '%s' from '%s'\n", output, input);
}
char* varstart = output;
if (prefix && strstr(output, prefix) == output) {
varstart = &output[strlen(prefix)];
}
varname = strdup(varstart);
if ((dot = strrchr(varstart, '.'))) {
varname[dot-varstart] = 0;
}
dot = varname;
while (*dot) {
if (strchr("/-.", *dot)) {
*dot = '_';
}
dot++;
}
fin = fopen(input, "rb");
if (!fin) {
fprintf(stderr, "cannot open '%s' for reading\n", input);
goto end;
}
fout = fopen(output, "wb");
if (!fout) {
fprintf(stderr, "cannot open '%s' for writing\n", output);
goto end;
}
fprintf(fout, "static const char* %s = \"", varname);
while ((ch = fgetc(fin)) != EOF) {
if (count == 0) {
fprintf(fout, "\\\n");
}
if (isalnum(ch)) {
switch (ch) {
case '"':
fputc('\\', fout);
fputc('"', fout);
break;
case '\t':
fputc('\\', fout);
fputc('t', fout);
break;
case '\n':
fputc('\\', fout);
fputc('n', fout);
break;
default:
fputc(ch, fout);
break;
}
} else {
fprintf(fout, "\\%03hho", (char) ch);
}
count = (count+1)%10;
size ++;
}
fprintf(fout, "\";\n");
fprintf(fout, "static int %s_size __attribute__((unused)) = %d;\n", varname, size);
end:
if (fin) {
fclose(fin);
}
if (fout) {
fclose(fout);
}
free(input);
free(output);
free(varname);
return 0;
}
|
resetius/graphtoys
|
opengl/program.c
|
<filename>opengl/program.c
#include "program.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <glad/gl.h>
struct ProgramImpl {
struct Program base;
GLuint program;
GLint major;
GLint minor;
void (*log)(const char* msg);
};
static void log_func(const char* msg) {
puts(msg);
}
static void prog_log(struct ProgramImpl* p, const char* format, ...) {
char buffer[256];
va_list args;
va_start(args, format);
vsnprintf(buffer, sizeof(buffer), format, args);
p->log(buffer);
va_end(args);
}
static void prog_free_(struct Program* p1) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLint numShaders = 0;
GLuint *shaders;
int i;
if (!p->program) {
return;
}
glGetProgramiv(p->program, GL_ATTACHED_SHADERS, &numShaders);
shaders = malloc(numShaders*sizeof(GLint));
glGetAttachedShaders(p->program, numShaders, NULL, shaders);
for (i = 0; i < numShaders; i++) {
glDeleteShader(shaders[i]);
}
free(shaders);
glDeleteProgram(p->program);
free(p);
}
static int prog_add_(struct ProgramImpl* p, const char* shaderText, GLuint shader) {
int result;
glShaderSource(shader, 1, &shaderText, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &result);
if (GL_FALSE == result) {
// get error log
int length = 0;
p->log("Shader compilation failed");
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
if (length > 0) {
char* msg = malloc(length+1);
int written = 0;
glGetShaderInfoLog(shader, length, &written, msg);
p->log(msg);
free(msg);
}
return 0;
}
glAttachShader(p->program, shader);
return 1;
}
static int prog_add_vs_(struct Program* p1, const char* shader) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLuint shaderId = glCreateShader(GL_VERTEX_SHADER);
return prog_add_(p, shader, shaderId);
}
static int prog_add_fs_(struct Program* p1, const char* shader) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLuint shaderId = glCreateShader(GL_FRAGMENT_SHADER);
return prog_add_(p, shader, shaderId);
}
static int prog_add_cs_(struct Program* p1, const char* shader) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
if (p->major > 4 || (p->major == 4 && p->minor >= 3)) {
GLuint shaderId = glCreateShader(GL_COMPUTE_SHADER);
return prog_add_(p, shader, shaderId);
} else {
printf("Compute shader is not supported\n");
exit(-1);
return -1;
}
}
static int prog_use_(struct Program* p1) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
glUseProgram(p->program);
return 1;
}
static int prog_link_(struct Program* p1) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
int result;
glLinkProgram(p->program);
glGetProgramiv(p->program, GL_LINK_STATUS, &result);
if (GL_FALSE == result) {
// get error log
int length = 0;
p->log("Program link failed");
glGetProgramiv(p->program, GL_INFO_LOG_LENGTH, &length);
if (length > 0) {
char* msg = malloc(length+1);
int written = 0;
glGetProgramInfoLog(p->program, length, &written, msg);
p->log(msg);
free(msg);
}
return 0;
}
return 1;
}
static int prog_set_mat3x3_(struct Program* p1, const char* name, const mat3x3* mat) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLint location = glGetUniformLocation(p->program, name);
if (location < 0) {
prog_log(p, "Unknown location: '%s'", name);
return 0;
}
glUniformMatrix3fv(location, 1, GL_FALSE, (const GLfloat*)mat);
return 1;
}
static int prog_set_mat4x4_(struct Program* p1, const char* name, const mat4x4* mat) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLint location = glGetUniformLocation(p->program, name);
if (location < 0) {
prog_log(p, "Unknown location: '%s'", name);
return 0;
}
glUniformMatrix4fv(location, 1, GL_FALSE, (const GLfloat*)mat);
return 1;
}
static int prog_set_vec3_(struct Program* p1, const char* name, const vec3* vec) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLint location = glGetUniformLocation(p->program, name);
if (location < 0) {
prog_log(p, "Unknown location: '%s'", name);
return 0;
}
glUniform3fv(location, 1, (const GLfloat*)vec);
return 1;
}
static int prog_set_int_(struct Program*p1, const char* name, int* values, int n_values) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLint location = glGetUniformLocation(p->program, name);
if (location < 0) {
prog_log(p, "Unknown location: '%s'", name);
return 0;
}
glUniform1iv(location, n_values, values);
return 1;
}
static int prog_set_sub_fs_(struct Program* p1, const char* name) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
GLuint location = glGetSubroutineIndex(p->program, GL_FRAGMENT_SHADER, name);
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, &location);
return 1;
}
static int prog_attrib_location_(struct Program* p1, const char* name) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
return glGetAttribLocation(p->program, name);
}
static int prog_handle_(struct Program* p1) {
struct ProgramImpl* p = (struct ProgramImpl*)p1;
return p->program;
}
struct Program* prog_opengl_new() {
struct ProgramImpl* p = calloc(1, sizeof(struct ProgramImpl));
struct Program base = {
.free = prog_free_,
.link = prog_link_,
.use = prog_use_,
.add_vs = prog_add_vs_,
.add_fs = prog_add_fs_,
.add_cs = prog_add_cs_,
.set_mat3x3 = prog_set_mat3x3_,
.set_mat4x4 = prog_set_mat4x4_,
.set_vec3 = prog_set_vec3_,
.set_int = prog_set_int_,
.set_sub_fs = prog_set_sub_fs_,
.attrib_location = prog_attrib_location_,
.handle = prog_handle_
};
p->base = base;
p->program = glCreateProgram();
p->log = log_func;
glGetIntegerv(GL_MAJOR_VERSION, &p->major);
glGetIntegerv(GL_MINOR_VERSION, &p->minor);
return (struct Program*)p;
}
void prog_free(struct Program* p) {
p->free(p);
}
int prog_add_vs(struct Program* p, const char* shader) {
return p->add_vs(p, shader);
}
int prog_add_fs(struct Program* p, const char* shader) {
return p->add_fs(p, shader);
}
int prog_add_cs(struct Program* p, const char* shader) {
return p->add_cs(p, shader);
}
int prog_link(struct Program* p) {
return p->link(p);
}
int prog_use(struct Program* p) {
return p->use(p);
}
int prog_validate(struct Program* p) {
return p->validate(p);
}
int prog_set_mat3x3(struct Program* p, const char* name, const mat3x3* mat) {
return p->set_mat3x3(p, name, mat);
}
int prog_set_mat4x4(struct Program* p, const char* name, const mat4x4* mat) {
return p->set_mat4x4(p, name, mat);
}
int prog_set_vec3(struct Program* p, const char* name, const vec3* vec) {
return p->set_vec3(p, name, vec);
}
int prog_set_int(struct Program* p, const char* name, int* values, int n_values) {
return p->set_int(p, name, values, n_values);
}
int prog_set_sub_fs(struct Program* p, const char* name) {
return p->set_sub_fs(p, name);
}
int prog_attrib_location(struct Program* p, const char* name) {
return p->attrib_location(p, name);
}
int prog_handle(struct Program* p) {
return p->handle(p);
}
|
resetius/graphtoys
|
vulkan/rendertarget.h
|
#pragma once
#include "vk.h"
struct RenderImpl;
struct RenderTarget {
VkImageView* imageviews;
int n_imageviews;
VkFramebuffer* framebuffers;
int n_framebuffers;
VkDevice dev;
VkImageView depth_imageview;
};
void rt_init(struct RenderTarget* rt, struct RenderImpl* r);
void rt_destroy(struct RenderTarget* rt);
|
resetius/graphtoys
|
render/pipeline.c
|
<reponame>resetius/graphtoys
#include "pipeline.h"
void pl_free(struct Pipeline* pl) {
pl->free(pl);
}
void pl_storage_assign(struct Pipeline* p1, int storage_id, int buffer_id)
{
p1->storage_assign(p1, storage_id, buffer_id);
}
void pl_uniform_assign(struct Pipeline* p1, int uniform_id, int buffer_id)
{
p1->uniform_assign(p1, uniform_id, buffer_id);
}
int pl_buffer_assign(struct Pipeline* p1, int descriptor_id, int buffer_id)
{
return p1->buffer_assign(p1, descriptor_id, buffer_id);
}
void pl_use_texture(struct Pipeline* pl, void* texture) {
pl->use_texture(pl, texture);
}
void pl_start(struct Pipeline* pl) {
pl->start(pl);
}
void pl_draw(struct Pipeline* pl, int buffer_id) {
pl->draw(pl, buffer_id);
}
|
resetius/graphtoys
|
models/triangle.h
|
<reponame>resetius/graphtoys
#pragma once
#include <lib/object.h>
struct Render;
struct Config;
struct Object* CreateTriangle(struct Render* r, struct Config*);
|
resetius/graphtoys
|
tools/stlprint.c
|
#include <stdio.h>
int main(int argc, char** argv) {
FILE* f;
char header[100];
int n_triangles;
int i,j;
if (argc < 2) {
printf("File name required\n");
return -1;
}
f = fopen(argv[1], "rb");
if (!f) {
printf("Cannot open file '%s'\n", argv[1]);
return -1;
}
fread(header, 1, 80, f);
header[80] = 0;
printf("header: '%s'\n", header);
fread(&n_triangles, 4, 1, f);
printf("ntriangles: %d\n", n_triangles);
for (i = 0; i < n_triangles; i++) {
float nx, ny, nz;
int attrs = 0;
fread(&nx, 4, 1, f);
fread(&ny, 4, 1, f);
fread(&nz, 4, 1, f);
printf("{\n");
printf(" normal: %f %f %f\n", nx, ny, nz);
for (j = 0; j < 3; j++) {
float x, y, z;
fread(&x, 4, 1, f);
fread(&y, 4, 1, f);
fread(&z, 4, 1, f);
printf(" v[%d]: %f %f %f\n", j, x, y, z);
}
fread(&attrs, 2, 1, f);
int r = attrs & 0x1f;
int g = (attrs>>5) & 0x1f;
int b = (attrs>>10) & 0x1f;
printf(" %d, %d, %d, %d\n", attrs, r, g, b);
attrs = 0;
printf(" attrs size: %d\n", attrs);
fseek(f, attrs, SEEK_CUR);
printf("}\n");
}
fclose(f);
return 0;
}
|
resetius/graphtoys
|
vulkan/commandbuffer.h
|
#pragma once
#include "vk.h"
struct RenderImpl;
struct CommandBuffer {
VkDevice dev;
VkCommandPool pool;
};
void cb_init(struct CommandBuffer* d, struct RenderImpl* r);
void cb_destroy(struct CommandBuffer* d);
void cb_begin(struct CommandBuffer* d, VkCommandBuffer buffer);
void cb_end(struct CommandBuffer* d, VkCommandBuffer buffer);
VkCommandBuffer cb_acquire(struct CommandBuffer* d);
void cb_reset(struct CommandBuffer* d);
|
resetius/graphtoys
|
main.c
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <render/render.h>
#include <font/font.h>
#include <lib/object.h>
#include <lib/config.h>
#include <lib/event.h>
#include <models/triangle.h>
#include <models/torus.h>
#include <models/mandelbrot.h>
#include <models/mandelbulb.h>
#include <models/stl.h>
#include <models/particles.h>
#include <models/particles2.h>
struct Object* CreateGltf(struct Render* r, struct Config* cfg);
struct App {
struct EventProducer events;
struct DrawContext ctx;
struct ObjectVec objs;
struct Render* r;
struct EventConsumer** cons;
int n_cons;
int cap_cons;
unsigned char key_mask[1000];
int xy_set;
double x;
double y;
};
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s\n", description);
}
static void resize_callback(GLFWwindow* window, int w, int h)
{
struct App* app = glfwGetWindowUserPointer(window);
app->ctx.w = w;
app->ctx.h = h;
app->ctx.ratio = w/(float)h;
app->r->set_viewport(app->r, w, h);
}
static void subscribe(struct EventProducer* prod, struct EventConsumer* cons) {
struct App* app = (struct App*)prod;
if (app->n_cons >= app->cap_cons) {
app->cap_cons = (1+app->cap_cons)*2;
app->cons = realloc(app->cons, app->cap_cons*sizeof(struct EventConsumer*));
}
app->cons[app->n_cons++] = cons;
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
struct App* app = glfwGetWindowUserPointer(window);
int i;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
if (key == GLFW_KEY_LEFT && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->move_left) {
app->objs.objs[i]->move_left(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_RIGHT && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->move_right) {
app->objs.objs[i]->move_right(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_UP && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->move_up) {
app->objs.objs[i]->move_up(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_DOWN && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->move_down) {
app->objs.objs[i]->move_down(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_A && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->zoom_in) {
app->objs.objs[i]->zoom_in(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_Z && action != GLFW_RELEASE) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->zoom_out) {
app->objs.objs[i]->zoom_out(app->objs.objs[i], mods);
}
}
} else if (key == GLFW_KEY_TAB && action == GLFW_PRESS) {
for (i = 0; i < app->objs.size; i++) {
if (app->objs.objs[i]->mode) {
app->objs.objs[i]->mode(app->objs.objs[i]);
}
}
}
//printf("%d %d %d\n", key, action, mods);
struct InputEvent ev = {
.key = key,
.scancode = scancode,
.action = action,
.mods = mods,
.mask = app->key_mask
};
if (key >= 0 && key < sizeof(app->key_mask) / sizeof(app->key_mask[0])) {
if (action == GLFW_PRESS) {
app->key_mask[key] = 1;
} else if (action == GLFW_RELEASE) {
app->key_mask[key] = 0;
}
}
for (i = 0; i < app->n_cons; i++) {
app->cons[i]->key_event(app->cons[i], &ev);
}
}
static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
{
struct App* app = glfwGetWindowUserPointer(window);
double dx, dy;
int i;
if (!app->xy_set) {
app->x = xpos; app->y = ypos; app->xy_set = 1; return;
}
dx = xpos - app->x;
dy = ypos - app->y;
struct InputEvent ev = {
.dx = dx,
.dy = dy,
.x = xpos,
.y = ypos,
.mask = app->key_mask
};
for (i = 0; i < app->n_cons; i++) {
app->cons[i]->mouse_move_event(app->cons[i], &ev);
}
app->x = xpos; app->y = ypos;
}
typedef struct Object* (*ConstructorT)(struct Render*, struct Config* cfg, struct EventProducer*);
struct ObjectAndConstructor {
const char* name;
ConstructorT constructor;
};
static void fill_render_config(struct RenderConfig* r, struct Config* cfg) {
const char* vsync;
r->api = cfg_gets_def(cfg, "render:api", "opengl");
printf("api: '%s'\n", r->api);
vsync = cfg_gets_def(cfg, "render:vsync", "on");
printf("vsync: %s\n", vsync);
if (!strcmp(vsync, "on")) {
r->vsync = 1;
} else {
r->vsync = 0;
}
printf("vsync: %d\n", r->vsync);
r->show_fps = strcmp(cfg_gets_def(cfg, "render:fps", "off"), "on") == 0;
r->triple_buffer = strcmp(cfg_gets_def(cfg, "render:triple_buffer", "off"), "on") == 0;
r->fullscreen = strcmp(cfg_gets_def(cfg, "render:fullscreen", "off"), "on") == 0;
r->vidmode = cfg_geti_def(cfg, "render:vidmode", -1);
r->cfg = cfg_section(cfg, "render");
}
int main(int argc, char** argv)
{
GLFWwindow* window = NULL;
struct App app;
struct Font* font = NULL;
struct Label fps;
//struct Label text;
struct Render* render = NULL;
struct Config* cfg = NULL;
struct RenderConfig rcfg;
float t1, t2;
long long frames = 0;
int enable_labels = 0;
struct ObjectAndConstructor constructors[] = {
{"torus", (ConstructorT)CreateTorus},
{"triangle", (ConstructorT)CreateTriangle},
{"mandelbrot", (ConstructorT)CreateMandelbrot},
{"mandelbulb", (ConstructorT)CreateMandelbulb},
{"stl", (ConstructorT)CreateStl},
{"particles", (ConstructorT)CreateParticles},
{"particles2", (ConstructorT)CreateParticles2},
{"gltf", (ConstructorT)CreateGltf},
{"test", NULL},
{NULL, NULL}
};
int i, j;
ConstructorT constr = (ConstructorT)CreateTorus;
const char* name = "torus";
memset(&app, 0, sizeof(app));
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--help")) {
for (j = 0; constructors[j].name; j++) {
printf("%s %s\n", argv[0], constructors[j].name);
}
return 0;
} else {
for (j = 0; constructors[j].name; j++) {
if (!strcmp(constructors[j].name, argv[i])) {
constr = constructors[j].constructor;
name = constructors[j].name;
break;
}
}
}
}
app.events.subscribe = subscribe;
glfwSetErrorCallback(error_callback);
/* Initialize the library */
if (!glfwInit()) {
return -1;
}
cfg = cfg_new("main.ini", argc, argv);
cfg_print(cfg);
fill_render_config(&rcfg, cfg);
enable_labels = rcfg.show_fps;
if (!strcmp(rcfg.api, "opengl")) {
render = rend_opengl_new(rcfg);
} else if (!strcmp(rcfg.api, "vulkan")) {
render = rend_vulkan_new(rcfg);
} else {
fprintf(stderr, "Unknown render: '%s'\n", rcfg.api);
return -1;
}
/* Create a windowed mode window and its OpenGL context */
char caption[256];
snprintf(caption, sizeof(caption), "GraphToys (%s)", rcfg.api);
window = glfwCreateWindow(640, 480, caption, NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
if (rcfg.fullscreen) {
int count;
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
for (int i = 0; i < count; i++) {
printf("mode %d: %dx%d@%d\n",
i, modes[i].width, modes[i].height, modes[i].refreshRate);
}
const GLFWvidmode* cur = glfwGetVideoMode(monitor);
printf("current: %dx%d@%d\n", cur->width, cur->height, cur->refreshRate);
if (rcfg.vidmode >= 0 && rcfg.vidmode < count) {
printf("use vidmode: %d\n", rcfg.vidmode);
cur = &modes[rcfg.vidmode];
}
glfwSetWindowMonitor(window, glfwGetPrimaryMonitor(), 0, 0, cur->width, cur->height, cur->refreshRate);
}
//glfwSetWindowMonitor(window, glfwGetPrimaryMonitor(), 0, 0, 640, 480, 60);
glfwSetWindowUserPointer(window, &app);
glfwSetKeyCallback(window, key_callback);
glfwSetCursorPosCallback(window, cursor_position_callback);
glfwSetFramebufferSizeCallback(window, resize_callback);
glfwGetFramebufferSize(window, &app.ctx.w, &app.ctx.h);
app.ctx.ratio = app.ctx.w/(float)app.ctx.h;
if (!strcmp(cfg_gets_def(cfg, "input:grab_mouse", "off"), "on")) {
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
if (glfwRawMouseMotionSupported()) {
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
}
}
/* Make the window's context current */
render->set_view_entity(render, window);
render->init(render);
app.r = render;
setbuf(stdout, NULL);
if (constr == NULL) {
ovec_add(&app.objs, CreateTriangle(render, cfg_section(cfg, "triangle")));
ovec_add(&app.objs, CreateTorus(render, cfg_section(cfg, "torus")));
} else {
ovec_add(&app.objs, constr(render, cfg_section(cfg, name), (struct EventProducer*) &app));
}
float scale_w, scale_h;
glfwGetWindowContentScale(window, &scale_w, &scale_h);
if (enable_labels) {
font = font_new(render, 0, 16*64, 150*scale_w, 150*scale_h);
label_ctor(&fps, font);
label_set_pos(&fps, 10, 10);
label_set_text(&fps, "FPS:");
//label_new(&text, font);
//label_set_pos(&text, 100, 200);
//label_set_text(text, "Проверка русских букв");
}
t1 = glfwGetTime();
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
render->draw_begin(render);
app.ctx.time = (float)glfwGetTime();
/* Render here */
if (enable_labels) {
label_set_screen(&fps, app.ctx.w, app.ctx.h);
//label_set_screen(text, app.ctx.w, app.ctx.h);
}
for (i = 0; i < app.objs.size; i++) {
app.objs.objs[i]->draw(app.objs.objs[i], &app.ctx);
}
if (enable_labels) {
label_render(&fps);
//label_render(text);
}
/* Swap front and back buffers */
render->draw_end(render);
/* Poll for and process events */
glfwPollEvents();
t2 = glfwGetTime();
frames ++;
if (t2 - t1 > 1.0) {
double fp = frames/(t2-t1);
double ms = 1000.*(t2-t1)/frames;
if (enable_labels) {
label_set_vtext(&fps, "FPS:%.2f, %.1fms", fp, ms);
}
printf("FPS:%.2f, %.1fms\n", fp, ms);
frames = 0;
t1 = t2;
}
}
ovec_free(&app.objs);
if (enable_labels) {
label_dtor(&fps);
//label_dtor(&text);
}
font_free(font);
rend_free(render);
cfg_free(cfg);
glfwTerminate();
return 0;
}
|
SneakersAgencyLLC/sneakers-analytics-ios-integration-localytics
|
Example/Pods/Headers/Public/Segment-Localytics/SEGLocalyticsIntegration.h
|
<reponame>SneakersAgencyLLC/sneakers-analytics-ios-integration-localytics<gh_stars>0
#import <Foundation/Foundation.h>
#import <Analytics/SEGIntegration.h>
@interface SEGLocalyticsIntegration : NSObject<SEGIntegration>
@property(nonatomic, strong) NSDictionary *settings;
- (id)initWithSettings:(NSDictionary *)settings;
@end
|
nanvix/optimsoc
|
external/opensocdebug/software/src/python/src/osd.c
|
<filename>external/opensocdebug/software/src/python/src/osd.c
/* Generated by Cython 0.29.10 */
/* BEGIN: Cython Metadata
{
"distutils": {
"depends": [],
"include_dirs": [
"/home/philipp/swinstall/osd/include",
"/home/philipp/swinstall/glip/include/glip"
],
"libraries": [
"osd",
"glip"
],
"library_dirs": [
"/home/philipp/swinstall/osd/lib64",
"/home/philipp/swinstall/glip/lib64"
],
"name": "osd",
"sources": [
"src/osd.pyx"
]
},
"module_name": "osd"
}
END: Cython Metadata */
#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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
#error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_10"
#define CYTHON_HEX_VERSION 0x001D0AF0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
#if PY_VERSION_HEX >= 0x02070000
#define HAVE_LONG_LONG
#endif
#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_PYSTON 0
#define CYTHON_COMPILING_IN_CPYTHON 0
#undef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 0
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#if PY_VERSION_HEX < 0x03050000
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
#define CYTHON_USE_ASYNC_SLOTS 1
#endif
#undef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 0
#undef CYTHON_USE_UNICODE_INTERNALS
#define CYTHON_USE_UNICODE_INTERNALS 0
#undef CYTHON_USE_UNICODE_WRITER
#define CYTHON_USE_UNICODE_WRITER 0
#undef CYTHON_USE_PYLONG_INTERNALS
#define CYTHON_USE_PYLONG_INTERNALS 0
#undef CYTHON_AVOID_BORROWED_REFS
#define CYTHON_AVOID_BORROWED_REFS 1
#undef CYTHON_ASSUME_SAFE_MACROS
#define CYTHON_ASSUME_SAFE_MACROS 0
#undef CYTHON_UNPACK_METHODS
#define CYTHON_UNPACK_METHODS 0
#undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#undef CYTHON_USE_DICT_VERSIONS
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_PYSTON 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#ifndef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 1
#endif
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#undef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 0
#ifndef CYTHON_USE_UNICODE_INTERNALS
#define CYTHON_USE_UNICODE_INTERNALS 1
#endif
#undef CYTHON_USE_UNICODE_WRITER
#define CYTHON_USE_UNICODE_WRITER 0
#undef CYTHON_USE_PYLONG_INTERNALS
#define CYTHON_USE_PYLONG_INTERNALS 0
#ifndef CYTHON_AVOID_BORROWED_REFS
#define CYTHON_AVOID_BORROWED_REFS 0
#endif
#ifndef CYTHON_ASSUME_SAFE_MACROS
#define CYTHON_ASSUME_SAFE_MACROS 1
#endif
#ifndef CYTHON_UNPACK_METHODS
#define CYTHON_UNPACK_METHODS 1
#endif
#undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#undef CYTHON_USE_DICT_VERSIONS
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_PYSTON 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#ifndef CYTHON_USE_TYPE_SLOTS
#define CYTHON_USE_TYPE_SLOTS 1
#endif
#if PY_VERSION_HEX < 0x02070000
#undef CYTHON_USE_PYTYPE_LOOKUP
#define CYTHON_USE_PYTYPE_LOOKUP 0
#elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
#define CYTHON_USE_PYTYPE_LOOKUP 1
#endif
#if PY_MAJOR_VERSION < 3
#undef CYTHON_USE_ASYNC_SLOTS
#define CYTHON_USE_ASYNC_SLOTS 0
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
#define CYTHON_USE_ASYNC_SLOTS 1
#endif
#if PY_VERSION_HEX < 0x02070000
#undef CYTHON_USE_PYLONG_INTERNALS
#define CYTHON_USE_PYLONG_INTERNALS 0
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
#define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#ifndef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 1
#endif
#ifndef CYTHON_USE_UNICODE_INTERNALS
#define CYTHON_USE_UNICODE_INTERNALS 1
#endif
#if PY_VERSION_HEX < 0x030300F0
#undef CYTHON_USE_UNICODE_WRITER
#define CYTHON_USE_UNICODE_WRITER 0
#elif !defined(CYTHON_USE_UNICODE_WRITER)
#define CYTHON_USE_UNICODE_WRITER 1
#endif
#ifndef CYTHON_AVOID_BORROWED_REFS
#define CYTHON_AVOID_BORROWED_REFS 0
#endif
#ifndef CYTHON_ASSUME_SAFE_MACROS
#define CYTHON_ASSUME_SAFE_MACROS 1
#endif
#ifndef CYTHON_UNPACK_METHODS
#define CYTHON_UNPACK_METHODS 1
#endif
#ifndef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 1
#endif
#ifndef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 1
#endif
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
#endif
#ifndef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
#endif
#ifndef CYTHON_USE_DICT_VERSIONS
#define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
#endif
#ifndef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
#endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#undef SHIFT
#undef BASE
#undef MASK
#ifdef SIZEOF_VOID_P
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
#endif
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
#define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#define CYTHON_RESTRICT __restrict__
#elif defined(_MSC_VER) && _MSC_VER >= 1400
#define CYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_RESTRICT restrict
#else
#define CYTHON_RESTRICT
#endif
#endif
#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
#ifndef CYTHON_MAYBE_UNUSED_VAR
# if defined(__cplusplus)
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
# else
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
# define CYTHON_NCP_UNUSED
# else
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
#ifndef _MSC_STDINT_H_
#if _MSC_VER < 1300
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
#else
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
#endif
#endif
#else
#include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
#if defined(__cplusplus) && __cplusplus >= 201103L
#if __has_cpp_attribute(fallthrough)
#define CYTHON_FALLTHROUGH [[fallthrough]]
#elif __has_cpp_attribute(clang::fallthrough)
#define CYTHON_FALLTHROUGH [[clang::fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
#define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
#endif
#endif
#ifndef CYTHON_FALLTHROUGH
#if __has_attribute(fallthrough)
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
#else
#define CYTHON_FALLTHROUGH
#endif
#endif
#if defined(__clang__ ) && defined(__apple_build_version__)
#if __apple_build_version__ < 7000000
#undef CYTHON_FALLTHROUGH
#define CYTHON_FALLTHROUGH
#endif
#endif
#endif
#ifndef CYTHON_INLINE
#if defined(__clang__)
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
#elif 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
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#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+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX < 0x030800A4
#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)
#else
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
#define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
#define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
#ifndef METH_FASTCALL
#define METH_FASTCALL 0x80
#endif
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
Py_ssize_t nargs, PyObject *kwnames);
#else
#define __Pyx_PyCFunctionFast _PyCFunctionFast
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
#define PyObject_Malloc(s) PyMem_Malloc(s)
#define PyObject_Free(p) PyMem_Free(p)
#define PyObject_Realloc(p) PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
#define PyMem_RawMalloc(n) PyMem_Malloc(n)
#define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
#define PyMem_RawFree(p) PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
#define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
#define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
#define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
*key = PyThread_create_key();
return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
*key = Py_tss_NEEDS_INIT;
return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
PyThread_delete_key(*key);
*key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n) PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
#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
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
#define CYTHON_PEP393_ENABLED 0
#define PyUnicode_1BYTE_KIND 1
#define PyUnicode_2BYTE_KIND 2
#define PyUnicode_4BYTE_KIND 4
#define __Pyx_PyUnicode_READY(op) (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]))
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
#else
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
#else
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
#define PyObject_ASCII(o) PyObject_Repr(o)
#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
#define PyObject_Unicode PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
#else
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
#endif
#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
#define PyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
#ifndef PyUnicode_InternFromString
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
#endif
#endif
#if PY_VERSION_HEX < 0x030200A4
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
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#else
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#endif
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
typedef struct {
unaryfunc am_await;
unaryfunc am_aiter;
unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
float value;
memset(&value, 0xFF, sizeof(value));
return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif
#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#define __PYX_HAVE__osd
#define __PYX_HAVE_API__osd
/* Early includes */
#include <stdio.h>
#include <Python.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/time.h>
#include "osd/osd.h"
#include "osd/packet.h"
#include "osd/hostmod.h"
#include "osd/hostctrl.h"
#include "libglip.h"
#include "osd/gateway.h"
#include "osd/gateway_glip.h"
#include "osd/cl_mam.h"
#include "osd/module.h"
#include "osd/memaccess.h"
#include "osd/systracelogger.h"
#include "osd/coretracelogger.h"
#include <stdlib.h>
#include <errno.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
(sizeof(type) < sizeof(Py_ssize_t)) ||\
(sizeof(type) > sizeof(Py_ssize_t) &&\
likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX) &&\
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
v == (type)PY_SSIZE_T_MIN))) ||\
(sizeof(type) == sizeof(Py_ssize_t) &&\
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
#include <cstdlib>
#define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
#define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
const Py_UNICODE *u_end = u;
while (*u_end++) ;
return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
ascii_chars[c] = c;
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
Py_DECREF(ascii_chars_u);
Py_DECREF(ascii_chars_b);
}
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
Py_DECREF(default_encoding);
return 0;
bad:
Py_XDECREF(default_encoding);
return -1;
}
#endif
#endif
/* Test for GCC > 2.95 */
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
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[] = {
"src/osd.pyx",
"stringsource",
};
/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
#define __PYX_FORCE_INIT_THREADS 0
#endif
/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()
/*--- Type declarations ---*/
struct __pyx_obj_3osd_Log;
struct __pyx_obj_3osd_PacketType;
struct __pyx_obj_3osd_Packet;
struct __pyx_obj_3osd_Hostmod;
struct __pyx_obj_3osd_GatewayGlip;
struct __pyx_obj_3osd_Hostctrl;
struct __pyx_obj_3osd_Module;
struct __pyx_obj_3osd_MemoryDescriptor;
struct __pyx_obj_3osd_MemoryAccess;
struct __pyx_obj_3osd_SystraceLogger;
struct __pyx_obj_3osd_CoretraceLogger;
struct __pyx_t_3osd_log_item;
/* "osd.pyx":42
*
*
* cdef struct log_item: # <<<<<<<<<<<<<<
* int priority
* const char *file
*/
struct __pyx_t_3osd_log_item {
int priority;
char const *file;
int line;
char const *fn;
char *msg;
size_t msg_len;
};
/* "osd.pyx":170
*
*
* cdef class Log: # <<<<<<<<<<<<<<
* cdef cosd.osd_log_ctx* _cself
*
*/
struct __pyx_obj_3osd_Log {
PyObject_HEAD
struct osd_log_ctx *_cself;
};
/* "osd.pyx":216
* # types, not from Python objects.
* #
* cdef class PacketType: # <<<<<<<<<<<<<<
*
* cdef cosd.osd_packet* _cself
*/
struct __pyx_obj_3osd_PacketType {
PyObject_HEAD
struct osd_packet *_cself;
};
/* "osd.pyx":209
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
* cdef class Packet(PacketType, MutableSequence): # <<<<<<<<<<<<<<
* pass
*
*/
struct __pyx_obj_3osd_Packet {
struct __pyx_obj_3osd_PacketType __pyx_base;
};
/* "osd.pyx":320
*
*
* cdef class Hostmod: # <<<<<<<<<<<<<<
* cdef cosd.osd_hostmod_ctx* _cself
*
*/
struct __pyx_obj_3osd_Hostmod {
PyObject_HEAD
struct osd_hostmod_ctx *_cself;
};
/* "osd.pyx":443
*
*
* cdef class GatewayGlip: # <<<<<<<<<<<<<<
* cdef cosd.osd_gateway_glip_ctx* _cself
*
*/
struct __pyx_obj_3osd_GatewayGlip {
PyObject_HEAD
struct osd_gateway_glip_ctx *_cself;
};
/* "osd.pyx":513
*
*
* cdef class Hostctrl: # <<<<<<<<<<<<<<
* cdef cosd.osd_hostctrl_ctx* _cself
*
*/
struct __pyx_obj_3osd_Hostctrl {
PyObject_HEAD
struct osd_hostctrl_ctx *_cself;
};
/* "osd.pyx":542
*
*
* cdef class Module: # <<<<<<<<<<<<<<
* @staticmethod
* def get_type_short_name(vendor_id, type_id):
*/
struct __pyx_obj_3osd_Module {
PyObject_HEAD
};
/* "osd.pyx":552
*
*
* cdef class MemoryDescriptor: # <<<<<<<<<<<<<<
* cdef cosd.osd_mem_desc _cself
*
*/
struct __pyx_obj_3osd_MemoryDescriptor {
PyObject_HEAD
struct osd_mem_desc _cself;
};
/* "osd.pyx":625
* return data
*
* cdef class MemoryAccess: # <<<<<<<<<<<<<<
* cdef cosd.osd_memaccess_ctx* _cself
*
*/
struct __pyx_obj_3osd_MemoryAccess {
PyObject_HEAD
struct osd_memaccess_ctx *_cself;
};
/* "osd.pyx":695
*
*
* cdef class SystraceLogger: # <<<<<<<<<<<<<<
* cdef cosd.osd_systracelogger_ctx* _cself
* cdef FILE* _fp_sysprint
*/
struct __pyx_obj_3osd_SystraceLogger {
PyObject_HEAD
struct osd_systracelogger_ctx *_cself;
FILE *_fp_sysprint;
FILE *_fp_event;
PyObject *_sysprint_file;
PyObject *_event_file;
};
/* "osd.pyx":790
*
*
* cdef class CoretraceLogger: # <<<<<<<<<<<<<<
* cdef cosd.osd_coretracelogger_ctx* _cself
* cdef FILE* _fp_log
*/
struct __pyx_obj_3osd_CoretraceLogger {
PyObject_HEAD
struct osd_coretracelogger_ctx *_cself;
FILE *_fp_log;
PyObject *_log_file;
PyObject *_elf_file;
};
/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#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);
#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
#define __Pyx_XDECREF_SET(r, v) do {\
PyObject *tmp = (PyObject *) r;\
r = v; __Pyx_XDECREF(tmp);\
} while (0)
#define __Pyx_DECREF_SET(r, v) do {\
PyObject *tmp = (PyObject *) r;\
r = v; __Pyx_DECREF(tmp);\
} while (0)
#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)
/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
(version_var) = __PYX_GET_DICT_VERSION(dict);\
(cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
static PY_UINT64_T __pyx_dict_version = 0;\
static PyObject *__pyx_dict_cached_value = NULL;\
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
(VAR) = __pyx_dict_cached_value;\
} else {\
(VAR) = __pyx_dict_cached_value = (LOOKUP);\
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
}\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict) (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
#endif
/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name) {\
static PY_UINT64_T __pyx_dict_version = 0;\
static PyObject *__pyx_dict_cached_value = NULL;\
(var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
(likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
__Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
PY_UINT64_T __pyx_dict_version;\
PyObject *__pyx_dict_cached_value;\
(var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif
/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
#endif
/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
(sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
static size_t __pyx_pyframe_localsplus_offset = 0;
#include "frameobject.h"
#define __Pxy_PyFrame_Initialize_Offsets()\
((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
(void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
#define __Pyx_PyFrame_GetLocalsplus(frame)\
(assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif
/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif
/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif
/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif
/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred() PyErr_Occurred()
#endif
/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
#endif
/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif
/* IncludeStringH.proto */
#include <string.h>
/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
int byteorder = 0;
return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
int byteorder = -1;
return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
int byteorder = 1;
return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
const char* cstring, Py_ssize_t start, Py_ssize_t stop,
const char* encoding, const char* errors,
PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
#endif
/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif
/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
int lineno, const char *filename,
int full_traceback, int nogil);
/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
/* RaiseArgTupleInvalid.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);
/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif
/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
const char* function_name);
/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif
/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list, int wraparound, int boundscheck);
/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
#endif
/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
(inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif
/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
__Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
Py_INCREF(x);
PyList_SET_ITEM(list, len, x);
Py_SIZE(list) = len+1;
return 0;
}
return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif
/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);
/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
(likely(is_tuple || PyTuple_Check(tuple)) ?\
(likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
__Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
(__Pyx_UnpackTupleError(tuple, 2), -1)) :\
__Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
#endif
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
((likely(PyLong_CheckExact(x))) ?\
(likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
#endif
/* PyObjectFormat.proto */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
#else
#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
#endif
/* PyUnicode_Unicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj);
/* PyObjectFormatAndDecref.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);
/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
Py_UCS4 max_char);
/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
(inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif
/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#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;
#if PY_VERSION_HEX < 0x030500A0
PyObject *func_weakreflist;
#endif
PyObject *func_dict;
PyObject *func_name;
PyObject *func_qualname;
PyObject *func_doc;
PyObject *func_globals;
PyObject *func_code;
PyObject *func_closure;
PyObject *func_classobj;
void *defaults;
int defaults_pyobjects;
int flags;
PyObject *defaults_tuple;
PyObject *defaults_kwdict;
PyObject *(*defaults_getter)(PyObject *);
PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
int flags, PyObject* qualname,
PyObject *self,
PyObject *module, PyObject *globals,
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 CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
PyObject *dict);
static int __pyx_CyFunction_init(void);
/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
(likely(PyDict_CheckExact(obj)) ?\
__Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
#endif
/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif
/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif
/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);
/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
(likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
(likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
#endif
/* PyType_Ready.proto */
static int __Pyx_PyType_Ready(PyTypeObject *t);
/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif
/* CodeObjectCache.proto */
typedef struct {
PyCodeObject* code_object;
int code_line;
} __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);
/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_osd_result(osd_result value);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value);
static PyObject* __pyx_convert__to_py_struct__osd_mem_desc_region(struct osd_mem_desc_region s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE enum osd_packet_type __Pyx_PyInt_As_enum__osd_packet_type(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *);
/* CIntFromPy.proto */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);
/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
/* Module declarations from 'cutil' */
/* Module declarations from 'libc.stdint' */
/* Module declarations from 'libc.string' */
/* Module declarations from 'libc.stdio' */
/* Module declarations from 'posix.types' */
/* Module declarations from 'posix.signal' */
/* Module declarations from 'posix.time' */
/* Module declarations from 'cosd' */
/* Module declarations from 'cpython.mem' */
/* Module declarations from 'libc.stdlib' */
/* Module declarations from 'libc.errno' */
/* Module declarations from 'osd' */
static PyTypeObject *__pyx_ptype_3osd_Log = 0;
static PyTypeObject *__pyx_ptype_3osd_PacketType = 0;
static PyTypeObject *__pyx_ptype_3osd_Packet = 0;
static PyTypeObject *__pyx_ptype_3osd_Hostmod = 0;
static PyTypeObject *__pyx_ptype_3osd_GatewayGlip = 0;
static PyTypeObject *__pyx_ptype_3osd_Hostctrl = 0;
static PyTypeObject *__pyx_ptype_3osd_Module = 0;
static PyTypeObject *__pyx_ptype_3osd_MemoryDescriptor = 0;
static PyTypeObject *__pyx_ptype_3osd_MemoryAccess = 0;
static PyTypeObject *__pyx_ptype_3osd_SystraceLogger = 0;
static PyTypeObject *__pyx_ptype_3osd_CoretraceLogger = 0;
static void __pyx_f_3osd_log_cb(struct osd_log_ctx *, int, char const *, int, char const *, char const *, va_list); /*proto*/
static int __pyx_f_3osd_log_cb_withgil(void *); /*proto*/
static PyObject *__pyx_f_3osd_loglevel_py2syslog(PyObject *); /*proto*/
static PyObject *__pyx_f_3osd_loglevel_syslog2py(PyObject *); /*proto*/
static PyObject *__pyx_f_3osd_check_osd_result(PyObject *); /*proto*/
static PyObject *__pyx_f_3osd___pyx_unpickle_Module__set_state(struct __pyx_obj_3osd_Module *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "osd"
extern int __pyx_module_is_main_osd;
int __pyx_module_is_main_osd = 0;
/* Implementation of 'osd' */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_IOError;
static const char __pyx_k_[] = "";
static const char __pyx_k_B[] = "B";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_1f[] = ".1f";
static const char __pyx_k_Ei[] = "Ei";
static const char __pyx_k_Gi[] = "Gi";
static const char __pyx_k_Ki[] = "Ki";
static const char __pyx_k_Mi[] = "Mi";
static const char __pyx_k_Pi[] = "Pi";
static const char __pyx_k_Ti[] = "Ti";
static const char __pyx_k_Yi[] = " Yi";
static const char __pyx_k_Zi[] = "Zi";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_rv[] = "rv";
static const char __pyx_k_Log[] = "Log";
static const char __pyx_k__17[] = " ";
static const char __pyx_k__21[] = " ";
static const char __pyx_k__22[] = "\n";
static const char __pyx_k_bit[] = " bit\n";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_len[] = "__len__";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_num[] = "num";
static const char __pyx_k_osd[] = "osd";
static const char __pyx_k_src[] = "src";
static const char __pyx_k_3_1f[] = "3.1f";
static const char __pyx_k_INFO[] = "INFO";
static const char __pyx_k_None[] = "None";
static const char __pyx_k_addr[] = "addr";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_dest[] = "dest";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_func[] = "func";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_size[] = ", size: ";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_unit[] = "unit";
static const char __pyx_k_vers[] = "vers";
static const char __pyx_k_DEBUG[] = "DEBUG";
static const char __pyx_k_ERROR[] = "ERROR";
static const char __pyx_k_UTF_8[] = "UTF-8";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_level[] = "level";
static const char __pyx_k_major[] = "major";
static const char __pyx_k_micro[] = "micro";
static const char __pyx_k_minor[] = "minor";
static const char __pyx_k_nbyte[] = "nbyte";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_Module[] = "Module";
static const char __pyx_k_NOTSET[] = "NOTSET";
static const char __pyx_k_Packet[] = "Packet";
static const char __pyx_k_c_data[] = "c_data";
static const char __pyx_k_diaddr[] = "diaddr";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_handle[] = "handle";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_insert[] = "insert";
static const char __pyx_k_lineno[] = "lineno";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "name";
static const char __pyx_k_packet[] = "packet";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_suffix[] = "suffix";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_vendor[] = "vendor";
static const char __pyx_k_verify[] = "verify";
static const char __pyx_k_Hostmod[] = "Hostmod";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_WARNING[] = "WARNING";
static const char __pyx_k_delitem[] = "__delitem__";
static const char __pyx_k_di_addr[] = "di_addr";
static const char __pyx_k_enabled[] = "enabled";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_hostmod[] = "hostmod";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_memsize[] = "memsize";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_regions[] = "regions";
static const char __pyx_k_setitem[] = "__setitem__";
static const char __pyx_k_type_id[] = "type_id";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_CRITICAL[] = "CRITICAL";
static const char __pyx_k_Hostctrl[] = "Hostctrl";
static const char __pyx_k_baseaddr[] = "baseaddr";
static const char __pyx_k_exc_info[] = "exc_info";
static const char __pyx_k_fsencode[] = "fsencode";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_mem_desc[] = "mem_desc";
static const char __pyx_k_pathname[] = "pathname";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_reg_addr[] = "reg_addr";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_type_sub[] = "type_sub";
static const char __pyx_k_LogRecord[] = "LogRecord";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_vendor_id[] = "vendor_id";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_PacketType[] = "PacketType";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_d_region_s[] = "%d region(s):\n";
static const char __pyx_k_disconnect[] = "disconnect";
static const char __pyx_k_is_running[] = "is_running";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_sizeof_fmt[] = "sizeof_fmt";
static const char __pyx_k_GatewayGlip[] = "GatewayGlip";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_cl_mam_read[] = "cl_mam_read";
static const char __pyx_k_mam_di_addr[] = "mam_di_addr";
static const char __pyx_k_src_osd_pyx[] = "src/osd.pyx";
static const char __pyx_k_MemoryAccess[] = "MemoryAccess";
static const char __pyx_k_cl_mam_write[] = "cl_mam_write";
static const char __pyx_k_ensure_cself[] = "_ensure_cself";
static const char __pyx_k_is_connected[] = "is_connected";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_reg_size_bit[] = "reg_size_bit";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_version_info[] = "version_info";
static const char __pyx_k_address_width[] = "address width = ";
static const char __pyx_k_clock_gettime[] = "clock_gettime";
static const char __pyx_k_elf_file_path[] = "elf_file_path";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_SystraceLogger[] = "SystraceLogger";
static const char __pyx_k_addr_width_bit[] = "addr_width_bit";
static const char __pyx_k_bit_data_width[] = " bit, data width = ";
static const char __pyx_k_connected_secs[] = "connected_secs";
static const char __pyx_k_data_width_bit[] = "data_width_bit";
static const char __pyx_k_router_address[] = "router_address";
static const char __pyx_k_CLOCK_MONOTONIC[] = "CLOCK_MONOTONIC";
static const char __pyx_k_CoretraceLogger[] = "CoretraceLogger";
static const char __pyx_k_MutableSequence[] = "MutableSequence";
static const char __pyx_k_base_address_0x[] = ": base address: 0x";
static const char __pyx_k_bytes_to_device[] = "bytes_to_device";
static const char __pyx_k_collections_abc[] = "collections.abc";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_MemoryDescriptor[] = "MemoryDescriptor";
static const char __pyx_k_Unknown_loglevel[] = "Unknown loglevel ";
static const char __pyx_k_OsdErrorException[] = "OsdErrorException";
static const char __pyx_k_PacketPayloadView[] = "PacketPayloadView";
static const char __pyx_k_bytes_from_device[] = "bytes_from_device";
static const char __pyx_k_getEffectiveLevel[] = "getEffectiveLevel";
static const char __pyx_k_glip_backend_name[] = "glip_backend_name";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_device_subnet_addr[] = "device_subnet_addr";
static const char __pyx_k_get_type_long_name[] = "get_type_long_name";
static const char __pyx_k_cl_mam_get_mem_desc[] = "cl_mam_get_mem_desc";
static const char __pyx_k_get_type_short_name[] = "get_type_short_name";
static const char __pyx_k_osd_library_version[] = "osd_library_version";
static const char __pyx_k_pyx_unpickle_Module[] = "__pyx_unpickle_Module";
static const char __pyx_k_Memory_read_failed_d[] = "Memory read failed (%d)";
static const char __pyx_k_glip_backend_options[] = "glip_backend_options";
static const char __pyx_k_Memory_write_failed_d[] = "Memory write failed (%d)";
static const char __pyx_k_PACKET_HEADER_WORD_CNT[] = "PACKET_HEADER_WORD_CNT";
static const char __pyx_k_PacketPayloadView___len[] = "PacketPayloadView.__len__";
static const char __pyx_k_host_controller_address[] = "host_controller_address";
static const char __pyx_k_str___locals_sizeof_fmt[] = "__str__.<locals>.sizeof_fmt";
static const char __pyx_k_PacketPayloadView___init[] = "PacketPayloadView.__init__";
static const char __pyx_k_PacketPayloadView_insert[] = "PacketPayloadView.insert";
static const char __pyx_k_PacketPayloadView___delitem[] = "PacketPayloadView.__delitem__";
static const char __pyx_k_PacketPayloadView___getitem[] = "PacketPayloadView.__getitem__";
static const char __pyx_k_PacketPayloadView___setitem[] = "PacketPayloadView.__setitem__";
static const char __pyx_k_self__cself_cannot_be_converted[] = "self._cself cannot be converted to a Python object for pickling";
static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
static const char __pyx_k_Memory_connected_to_MAM_module_a[] = "Memory connected to MAM module at DI address %d.\n";
static const char __pyx_k_Packet_must_have_at_least_3_head[] = "Packet must have at least 3 (header) words.";
static const char __pyx_k_XXX_Extend_to_support_other_size[] = "XXX: Extend to support other sizes than 16 bit registers";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static PyObject *__pyx_kp_u_;
static PyObject *__pyx_kp_u_1f;
static PyObject *__pyx_kp_u_3_1f;
static PyObject *__pyx_n_u_B;
static PyObject *__pyx_n_s_CLOCK_MONOTONIC;
static PyObject *__pyx_n_s_CRITICAL;
static PyObject *__pyx_n_s_CoretraceLogger;
static PyObject *__pyx_n_s_DEBUG;
static PyObject *__pyx_n_s_ERROR;
static PyObject *__pyx_n_u_Ei;
static PyObject *__pyx_n_s_GatewayGlip;
static PyObject *__pyx_n_u_Gi;
static PyObject *__pyx_n_s_Hostctrl;
static PyObject *__pyx_n_s_Hostmod;
static PyObject *__pyx_n_s_INFO;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_u_Ki;
static PyObject *__pyx_n_s_Log;
static PyObject *__pyx_n_s_LogRecord;
static PyObject *__pyx_n_s_MemoryAccess;
static PyObject *__pyx_n_s_MemoryDescriptor;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_u_Memory_connected_to_MAM_module_a;
static PyObject *__pyx_kp_u_Memory_read_failed_d;
static PyObject *__pyx_kp_u_Memory_write_failed_d;
static PyObject *__pyx_n_u_Mi;
static PyObject *__pyx_n_s_Module;
static PyObject *__pyx_n_s_MutableSequence;
static PyObject *__pyx_n_s_NOTSET;
static PyObject *__pyx_kp_u_None;
static PyObject *__pyx_n_s_OsdErrorException;
static PyObject *__pyx_n_s_PACKET_HEADER_WORD_CNT;
static PyObject *__pyx_n_s_Packet;
static PyObject *__pyx_n_s_PacketPayloadView;
static PyObject *__pyx_n_s_PacketPayloadView___delitem;
static PyObject *__pyx_n_s_PacketPayloadView___getitem;
static PyObject *__pyx_n_s_PacketPayloadView___init;
static PyObject *__pyx_n_s_PacketPayloadView___len;
static PyObject *__pyx_n_s_PacketPayloadView___setitem;
static PyObject *__pyx_n_s_PacketPayloadView_insert;
static PyObject *__pyx_n_s_PacketType;
static PyObject *__pyx_kp_u_Packet_must_have_at_least_3_head;
static PyObject *__pyx_n_u_Pi;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_SystraceLogger;
static PyObject *__pyx_n_u_Ti;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_u_UTF_8;
static PyObject *__pyx_kp_u_Unknown_loglevel;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_WARNING;
static PyObject *__pyx_kp_u_XXX_Extend_to_support_other_size;
static PyObject *__pyx_kp_u_Yi;
static PyObject *__pyx_n_u_Zi;
static PyObject *__pyx_kp_u__17;
static PyObject *__pyx_kp_u__21;
static PyObject *__pyx_kp_u__22;
static PyObject *__pyx_n_s_addr;
static PyObject *__pyx_n_u_addr;
static PyObject *__pyx_n_s_addr_width_bit;
static PyObject *__pyx_kp_u_address_width;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_kp_u_base_address_0x;
static PyObject *__pyx_n_s_baseaddr;
static PyObject *__pyx_n_u_baseaddr;
static PyObject *__pyx_kp_u_bit;
static PyObject *__pyx_kp_u_bit_data_width;
static PyObject *__pyx_n_u_bytes_from_device;
static PyObject *__pyx_n_u_bytes_to_device;
static PyObject *__pyx_n_s_c_data;
static PyObject *__pyx_n_s_cl_mam_get_mem_desc;
static PyObject *__pyx_n_s_cl_mam_read;
static PyObject *__pyx_n_s_cl_mam_write;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clock_gettime;
static PyObject *__pyx_n_s_collections_abc;
static PyObject *__pyx_n_u_connected_secs;
static PyObject *__pyx_n_u_d;
static PyObject *__pyx_kp_u_d_region_s;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_width_bit;
static PyObject *__pyx_n_s_delitem;
static PyObject *__pyx_n_s_dest;
static PyObject *__pyx_n_s_device_subnet_addr;
static PyObject *__pyx_n_s_di_addr;
static PyObject *__pyx_n_s_diaddr;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_disconnect;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_elf_file_path;
static PyObject *__pyx_n_s_enabled;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_ensure_cself;
static PyObject *__pyx_n_s_exc_info;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_fsencode;
static PyObject *__pyx_n_s_func;
static PyObject *__pyx_n_s_getEffectiveLevel;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_get_type_long_name;
static PyObject *__pyx_n_s_get_type_short_name;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_glip_backend_name;
static PyObject *__pyx_n_s_glip_backend_options;
static PyObject *__pyx_n_s_handle;
static PyObject *__pyx_n_s_host_controller_address;
static PyObject *__pyx_n_s_hostmod;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_insert;
static PyObject *__pyx_n_s_is_connected;
static PyObject *__pyx_n_s_is_running;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_n_s_level;
static PyObject *__pyx_n_s_lineno;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_u_major;
static PyObject *__pyx_n_s_mam_di_addr;
static PyObject *__pyx_n_s_mem_desc;
static PyObject *__pyx_n_s_memsize;
static PyObject *__pyx_n_u_memsize;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_u_micro;
static PyObject *__pyx_n_u_minor;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_nbyte;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_num;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_osd;
static PyObject *__pyx_n_s_osd_library_version;
static PyObject *__pyx_n_s_packet;
static PyObject *__pyx_n_s_pathname;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Module;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reg_addr;
static PyObject *__pyx_n_s_reg_size_bit;
static PyObject *__pyx_n_s_regions;
static PyObject *__pyx_n_s_router_address;
static PyObject *__pyx_n_s_rv;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_kp_s_self__cself_cannot_be_converted;
static PyObject *__pyx_n_s_setitem;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_kp_u_size;
static PyObject *__pyx_n_s_sizeof_fmt;
static PyObject *__pyx_n_s_src;
static PyObject *__pyx_kp_s_src_osd_pyx;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_str___locals_sizeof_fmt;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_suffix;
static PyObject *__pyx_n_u_suffix;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_u_type;
static PyObject *__pyx_n_s_type_id;
static PyObject *__pyx_n_s_type_sub;
static PyObject *__pyx_n_s_unit;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_u_vendor;
static PyObject *__pyx_n_s_vendor_id;
static PyObject *__pyx_n_s_verify;
static PyObject *__pyx_n_s_vers;
static PyObject *__pyx_n_u_version;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_u_x;
static PyObject *__pyx_pf_3osd_osd_library_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_3osd_3Log___cinit__(struct __pyx_obj_3osd_Log *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_3Log_2__dealloc(struct __pyx_obj_3osd_Log *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_3Log_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Log *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_3Log_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Log *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_packet); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView_2__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView_4__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView_6__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView_8__delitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_3osd_17PacketPayloadView_10insert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_3osd_6Packet___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Packet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_6Packet_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Packet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType__ensure_cself(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static void __pyx_pf_3osd_10PacketType_2__dealloc__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_3osd_10PacketType_4__len__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_6__getitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_pf_3osd_10PacketType_8__setitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_3osd_10PacketType_10__delitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_12insert(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_3src___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_4dest___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_4type___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_8type_sub___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_14set_header(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_dest, PyObject *__pyx_v_src, PyObject *__pyx_v_type, PyObject *__pyx_v_type_sub); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_7payload___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_16__str__(struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_PacketType *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_10PacketType_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_PacketType *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_7Hostmod___cinit__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_3osd_7Hostmod_2__dealloc__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_4connect(struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_6disconnect(struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_8is_connected(struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_6diaddr___get__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_10reg_read(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_diaddr, PyObject *__pyx_v_reg_addr, PyObject *__pyx_v_reg_size_bit, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_12reg_write(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_diaddr, PyObject *__pyx_v_reg_addr, PyObject *__pyx_v_reg_size_bit, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_14get_modules(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_16mod_describe(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_18mod_set_event_dest(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_20mod_set_event_active(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr, PyObject *__pyx_v_enabled, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_22get_max_event_words(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr_target); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_24event_send(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, struct __pyx_obj_3osd_Packet *__pyx_v_event_pkg); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_26event_receive(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_flags); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostmod *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_7Hostmod_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostmod *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_11GatewayGlip___cinit__(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_device_subnet_addr, PyObject *__pyx_v_glip_backend_name, PyObject *__pyx_v_glip_backend_options); /* proto */
static void __pyx_pf_3osd_11GatewayGlip_2__dealloc__(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_4connect(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_6disconnect(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_8is_connected(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_10get_transfer_stats(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_11GatewayGlip_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_8Hostctrl___cinit__(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_router_address); /* proto */
static void __pyx_pf_3osd_8Hostctrl_2__dealloc__(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_8Hostctrl_4start(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_8Hostctrl_6stop(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_8Hostctrl_8is_running(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_8Hostctrl_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostctrl *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_8Hostctrl_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostctrl *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_3osd_6Module_get_type_short_name(PyObject *__pyx_v_vendor_id, PyObject *__pyx_v_type_id); /* proto */
static PyObject *__pyx_pf_3osd_6Module_2get_type_long_name(PyObject *__pyx_v_vendor_id, PyObject *__pyx_v_type_id); /* proto */
static PyObject *__pyx_pf_3osd_6Module_4__reduce_cython__(struct __pyx_obj_3osd_Module *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_6Module_6__setstate_cython__(struct __pyx_obj_3osd_Module *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_16MemoryDescriptor___cinit__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7regions___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_14addr_width_bit___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_14data_width_bit___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7di_addr___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7__str___sizeof_fmt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num, PyObject *__pyx_v_suffix); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_2__str__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_3osd_2cl_mam_get_mem_desc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_mam_di_addr); /* proto */
static PyObject *__pyx_pf_3osd_4cl_mam_write(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_data, PyObject *__pyx_v_addr); /* proto */
static PyObject *__pyx_pf_3osd_6cl_mam_read(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_addr, PyObject *__pyx_v_nbyte); /* proto */
static int __pyx_pf_3osd_12MemoryAccess___cinit__(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address); /* proto */
static void __pyx_pf_3osd_12MemoryAccess_2__dealloc__(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_4connect(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_6disconnect(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_8is_connected(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_10cpus_stop(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_12cpus_start(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_14find_memories(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_16loadelf(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, PyObject *__pyx_v_elf_file_path, PyObject *__pyx_v_verify); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_12MemoryAccess_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_14SystraceLogger___cinit__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_di_addr); /* proto */
static void __pyx_pf_3osd_14SystraceLogger_2__dealloc__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_4connect(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_6disconnect(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_8is_connected(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_10stop(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_12start(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_12sysprint_log___get__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static int __pyx_pf_3osd_14SystraceLogger_12sysprint_log_2__set__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_9event_log___get__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static int __pyx_pf_3osd_14SystraceLogger_9event_log_2__set__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_14SystraceLogger_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_3osd_15CoretraceLogger___cinit__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_di_addr); /* proto */
static void __pyx_pf_3osd_15CoretraceLogger_2__dealloc__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_4connect(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_6disconnect(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8is_connected(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_10stop(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_12start(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8log_file___get__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static int __pyx_pf_3osd_15CoretraceLogger_8log_file_2__set__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8elf_file___get__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static int __pyx_pf_3osd_15CoretraceLogger_8elf_file_2__set__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, PyObject *__pyx_v_elf_filename); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3osd_15CoretraceLogger_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_3osd_8__pyx_unpickle_Module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_3osd_Log(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_PacketType(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_Packet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_Hostmod(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_GatewayGlip(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_Hostctrl(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_Module(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_MemoryDescriptor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_MemoryAccess(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_SystraceLogger(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3osd_CoretraceLogger(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_1024_0;
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_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_222419149;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__48;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
/* Late includes */
/* "osd.pyx":32
*
*
* def osd_library_version(): # <<<<<<<<<<<<<<
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {}
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_1osd_library_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_osd_library_version[] = "osd_library_version()";
static PyMethodDef __pyx_mdef_3osd_1osd_library_version = {"osd_library_version", (PyCFunction)__pyx_pw_3osd_1osd_library_version, METH_NOARGS, __pyx_doc_3osd_osd_library_version};
static PyObject *__pyx_pw_3osd_1osd_library_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("osd_library_version (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_osd_library_version(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_osd_library_version(CYTHON_UNUSED PyObject *__pyx_self) {
struct osd_version const *__pyx_v_vers;
PyObject *__pyx_v_version_info = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("osd_library_version", 0);
/* "osd.pyx":33
*
* def osd_library_version():
* cdef const cosd.osd_version* vers = cosd.osd_version_get() # <<<<<<<<<<<<<<
* version_info = {}
* version_info['major'] = vers.major
*/
__pyx_v_vers = osd_version_get();
/* "osd.pyx":34
* def osd_library_version():
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {} # <<<<<<<<<<<<<<
* version_info['major'] = vers.major
* version_info['minor'] = vers.minor
*/
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_version_info = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "osd.pyx":35
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {}
* version_info['major'] = vers.major # <<<<<<<<<<<<<<
* version_info['minor'] = vers.minor
* version_info['micro'] = vers.micro
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_vers->major); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(PyDict_SetItem(__pyx_v_version_info, __pyx_n_u_major, __pyx_t_1) < 0)) __PYX_ERR(0, 35, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":36
* version_info = {}
* version_info['major'] = vers.major
* version_info['minor'] = vers.minor # <<<<<<<<<<<<<<
* version_info['micro'] = vers.micro
* version_info['suffix'] = vers.suffix
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_vers->minor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(PyDict_SetItem(__pyx_v_version_info, __pyx_n_u_minor, __pyx_t_1) < 0)) __PYX_ERR(0, 36, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":37
* version_info['major'] = vers.major
* version_info['minor'] = vers.minor
* version_info['micro'] = vers.micro # <<<<<<<<<<<<<<
* version_info['suffix'] = vers.suffix
* return version_info
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_vers->micro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(PyDict_SetItem(__pyx_v_version_info, __pyx_n_u_micro, __pyx_t_1) < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":38
* version_info['minor'] = vers.minor
* version_info['micro'] = vers.micro
* version_info['suffix'] = vers.suffix # <<<<<<<<<<<<<<
* return version_info
*
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_vers->suffix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(PyDict_SetItem(__pyx_v_version_info, __pyx_n_u_suffix, __pyx_t_1) < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":39
* version_info['micro'] = vers.micro
* version_info['suffix'] = vers.suffix
* return version_info # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_version_info);
__pyx_r = __pyx_v_version_info;
goto __pyx_L0;
/* "osd.pyx":32
*
*
* def osd_library_version(): # <<<<<<<<<<<<<<
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {}
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.osd_library_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_version_info);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":50
* size_t msg_len
*
* cdef void log_cb(cosd.osd_log_ctx *ctx, int priority, const char *file, # <<<<<<<<<<<<<<
* int line, const char *fn, const char *format,
* cosd.va_list args) nogil:
*/
static void __pyx_f_3osd_log_cb(CYTHON_UNUSED struct osd_log_ctx *__pyx_v_ctx, int __pyx_v_priority, char const *__pyx_v_file, int __pyx_v_line, char const *__pyx_v_fn, char const *__pyx_v_format, va_list __pyx_v_args) {
char *__pyx_v_msg;
int __pyx_v_msg_len;
struct __pyx_t_3osd_log_item *__pyx_v_item;
int __pyx_t_1;
/* "osd.pyx":60
* """
* # Get log message as string
* cdef char* msg = NULL # <<<<<<<<<<<<<<
* msg_len = vasprintf(&msg, format, args)
* if msg_len == -1:
*/
__pyx_v_msg = NULL;
/* "osd.pyx":61
* # Get log message as string
* cdef char* msg = NULL
* msg_len = vasprintf(&msg, format, args) # <<<<<<<<<<<<<<
* if msg_len == -1:
* # out of memory: skip log entry
*/
__pyx_v_msg_len = vasprintf((&__pyx_v_msg), __pyx_v_format, __pyx_v_args);
/* "osd.pyx":62
* cdef char* msg = NULL
* msg_len = vasprintf(&msg, format, args)
* if msg_len == -1: # <<<<<<<<<<<<<<
* # out of memory: skip log entry
* return
*/
__pyx_t_1 = ((__pyx_v_msg_len == -1L) != 0);
if (__pyx_t_1) {
/* "osd.pyx":64
* if msg_len == -1:
* # out of memory: skip log entry
* return # <<<<<<<<<<<<<<
*
* cdef log_item *item = <log_item*>malloc(sizeof(log_item))
*/
goto __pyx_L0;
/* "osd.pyx":62
* cdef char* msg = NULL
* msg_len = vasprintf(&msg, format, args)
* if msg_len == -1: # <<<<<<<<<<<<<<
* # out of memory: skip log entry
* return
*/
}
/* "osd.pyx":66
* return
*
* cdef log_item *item = <log_item*>malloc(sizeof(log_item)) # <<<<<<<<<<<<<<
* item.priority = priority
* item.file = file
*/
__pyx_v_item = ((struct __pyx_t_3osd_log_item *)malloc((sizeof(struct __pyx_t_3osd_log_item))));
/* "osd.pyx":67
*
* cdef log_item *item = <log_item*>malloc(sizeof(log_item))
* item.priority = priority # <<<<<<<<<<<<<<
* item.file = file
* item.line = line
*/
__pyx_v_item->priority = __pyx_v_priority;
/* "osd.pyx":68
* cdef log_item *item = <log_item*>malloc(sizeof(log_item))
* item.priority = priority
* item.file = file # <<<<<<<<<<<<<<
* item.line = line
* item.fn = fn
*/
__pyx_v_item->file = __pyx_v_file;
/* "osd.pyx":69
* item.priority = priority
* item.file = file
* item.line = line # <<<<<<<<<<<<<<
* item.fn = fn
* item.msg = msg
*/
__pyx_v_item->line = __pyx_v_line;
/* "osd.pyx":70
* item.file = file
* item.line = line
* item.fn = fn # <<<<<<<<<<<<<<
* item.msg = msg
* item.msg_len = msg_len
*/
__pyx_v_item->fn = __pyx_v_fn;
/* "osd.pyx":71
* item.line = line
* item.fn = fn
* item.msg = msg # <<<<<<<<<<<<<<
* item.msg_len = msg_len
*
*/
__pyx_v_item->msg = __pyx_v_msg;
/* "osd.pyx":72
* item.fn = fn
* item.msg = msg
* item.msg_len = msg_len # <<<<<<<<<<<<<<
*
* # Queue callback to process item with GIL held
*/
__pyx_v_item->msg_len = __pyx_v_msg_len;
/* "osd.pyx":75
*
* # Queue callback to process item with GIL held
* Py_AddPendingCall(log_cb_withgil, <void*>item) # <<<<<<<<<<<<<<
*
* cdef int log_cb_withgil(void* item_void) with gil:
*/
(void)(Py_AddPendingCall(__pyx_f_3osd_log_cb_withgil, ((void *)__pyx_v_item)));
/* "osd.pyx":50
* size_t msg_len
*
* cdef void log_cb(cosd.osd_log_ctx *ctx, int priority, const char *file, # <<<<<<<<<<<<<<
* int line, const char *fn, const char *format,
* cosd.va_list args) nogil:
*/
/* function exit code */
__pyx_L0:;
}
/* "osd.pyx":77
* Py_AddPendingCall(log_cb_withgil, <void*>item)
*
* cdef int log_cb_withgil(void* item_void) with gil: # <<<<<<<<<<<<<<
* """
* Process a log entry with GIL held
*/
static int __pyx_f_3osd_log_cb_withgil(void *__pyx_v_item_void) {
struct __pyx_t_3osd_log_item *__pyx_v_item;
PyObject *__pyx_v_logger = NULL;
PyObject *__pyx_v_u_file = NULL;
PyObject *__pyx_v_u_fn = NULL;
PyObject *__pyx_v_u_msg = NULL;
PyObject *__pyx_v_record = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
char const *__pyx_t_9;
char const *__pyx_t_10;
int __pyx_t_11;
int __pyx_t_12;
char const *__pyx_t_13;
PyObject *__pyx_t_14 = NULL;
PyObject *__pyx_t_15 = NULL;
PyObject *__pyx_t_16 = NULL;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
#endif
__Pyx_RefNannySetupContext("log_cb_withgil", 0);
/* "osd.pyx":87
* is held).
* """
* cdef log_item *item = <log_item*> item_void # <<<<<<<<<<<<<<
* if not item:
* return 0
*/
__pyx_v_item = ((struct __pyx_t_3osd_log_item *)__pyx_v_item_void);
/* "osd.pyx":88
* """
* cdef log_item *item = <log_item*> item_void
* if not item: # <<<<<<<<<<<<<<
* return 0
*
*/
__pyx_t_1 = ((!(__pyx_v_item != 0)) != 0);
if (__pyx_t_1) {
/* "osd.pyx":89
* cdef log_item *item = <log_item*> item_void
* if not item:
* return 0 # <<<<<<<<<<<<<<
*
* try:
*/
__pyx_r = 0;
goto __pyx_L0;
/* "osd.pyx":88
* """
* cdef log_item *item = <log_item*> item_void
* if not item: # <<<<<<<<<<<<<<
* return 0
*
*/
}
/* "osd.pyx":91
* return 0
*
* try: # <<<<<<<<<<<<<<
* logger = logging.getLogger(__name__)
* except:
*/
{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_4);
/*try:*/ {
/* "osd.pyx":92
*
* try:
* logger = logging.getLogger(__name__) # <<<<<<<<<<<<<<
* except:
* # In the shutdown phase this function is called, but the logging
*/
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_logging); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_8 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_8)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
}
}
__pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_v_logger = __pyx_t_5;
__pyx_t_5 = 0;
/* "osd.pyx":91
* return 0
*
* try: # <<<<<<<<<<<<<<
* logger = logging.getLogger(__name__)
* except:
*/
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L9_try_end;
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "osd.pyx":93
* try:
* logger = logging.getLogger(__name__)
* except: # <<<<<<<<<<<<<<
* # In the shutdown phase this function is called, but the logging
* # system is already destroyed. Discard messages.
*/
/*except:*/ {
__Pyx_AddTraceback("osd.log_cb_withgil", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(0, 93, __pyx_L6_except_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GOTREF(__pyx_t_6);
/* "osd.pyx":96
* # In the shutdown phase this function is called, but the logging
* # system is already destroyed. Discard messages.
* free(item) # <<<<<<<<<<<<<<
* return 0
*
*/
free(__pyx_v_item);
/* "osd.pyx":97
* # system is already destroyed. Discard messages.
* free(item)
* return 0 # <<<<<<<<<<<<<<
*
* # handle log entry
*/
__pyx_r = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_except_return;
}
__pyx_L6_except_error:;
/* "osd.pyx":91
* return 0
*
* try: # <<<<<<<<<<<<<<
* logger = logging.getLogger(__name__)
* except:
*/
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L1_error;
__pyx_L7_except_return:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L0;
__pyx_L9_try_end:;
}
/* "osd.pyx":100
*
* # handle log entry
* u_file = item.file.decode('UTF-8') # <<<<<<<<<<<<<<
* u_fn = item.fn.decode('UTF-8')
* try:
*/
__pyx_t_9 = __pyx_v_item->file;
__pyx_t_6 = __Pyx_decode_c_string(__pyx_t_9, 0, strlen(__pyx_t_9), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_6);
__pyx_v_u_file = __pyx_t_6;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "osd.pyx":101
* # handle log entry
* u_file = item.file.decode('UTF-8')
* u_fn = item.fn.decode('UTF-8') # <<<<<<<<<<<<<<
* try:
* u_msg = item.msg[:item.msg_len].decode('UTF-8')
*/
__pyx_t_10 = __pyx_v_item->fn;
__pyx_t_6 = __Pyx_decode_c_string(__pyx_t_10, 0, strlen(__pyx_t_10), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_t_6);
__pyx_v_u_fn = __pyx_t_6;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
/* "osd.pyx":102
* u_file = item.file.decode('UTF-8')
* u_fn = item.fn.decode('UTF-8')
* try: # <<<<<<<<<<<<<<
* u_msg = item.msg[:item.msg_len].decode('UTF-8')
* finally:
*/
/*try:*/ {
/* "osd.pyx":103
* u_fn = item.fn.decode('UTF-8')
* try:
* u_msg = item.msg[:item.msg_len].decode('UTF-8') # <<<<<<<<<<<<<<
* finally:
* free(item.msg)
*/
__pyx_t_6 = __Pyx_decode_c_string(__pyx_v_item->msg, 0, __pyx_v_item->msg_len, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_v_u_msg = __pyx_t_6;
__pyx_t_6 = 0;
}
/* "osd.pyx":105
* u_msg = item.msg[:item.msg_len].decode('UTF-8')
* finally:
* free(item.msg) # <<<<<<<<<<<<<<
*
* # create log record and pass it to the Python logger
*/
/*finally:*/ {
/*normal exit:*/{
free(__pyx_v_item->msg);
goto __pyx_L14;
}
__pyx_L13_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
{
free(__pyx_v_item->msg);
}
if (PY_MAJOR_VERSION >= 3) {
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
}
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
__pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
goto __pyx_L1_error;
}
__pyx_L14:;
}
/* "osd.pyx":108
*
* # create log record and pass it to the Python logger
* record = logging.LogRecord(name = __name__, # <<<<<<<<<<<<<<
* level = loglevel_syslog2py(item.priority),
* pathname = u_file,
*/
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_logging); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_LogRecord); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_name_2, __pyx_t_5) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "osd.pyx":109
* # create log record and pass it to the Python logger
* record = logging.LogRecord(name = __name__,
* level = loglevel_syslog2py(item.priority), # <<<<<<<<<<<<<<
* pathname = u_file,
* lineno = item.line,
*/
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_item->priority); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_8 = __pyx_f_3osd_loglevel_syslog2py(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 109, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_level, __pyx_t_8) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "osd.pyx":110
* record = logging.LogRecord(name = __name__,
* level = loglevel_syslog2py(item.priority),
* pathname = u_file, # <<<<<<<<<<<<<<
* lineno = item.line,
* func = u_fn,
*/
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_pathname, __pyx_v_u_file) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
/* "osd.pyx":111
* level = loglevel_syslog2py(item.priority),
* pathname = u_file,
* lineno = item.line, # <<<<<<<<<<<<<<
* func = u_fn,
* msg = u_msg,
*/
__pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_item->line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_lineno, __pyx_t_8) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "osd.pyx":112
* pathname = u_file,
* lineno = item.line,
* func = u_fn, # <<<<<<<<<<<<<<
* msg = u_msg,
* args = '',
*/
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_func, __pyx_v_u_fn) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
/* "osd.pyx":113
* lineno = item.line,
* func = u_fn,
* msg = u_msg, # <<<<<<<<<<<<<<
* args = '',
* exc_info = None)
*/
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_msg, __pyx_v_u_msg) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_args, __pyx_kp_u_) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
/* "osd.pyx":115
* msg = u_msg,
* args = '',
* exc_info = None) # <<<<<<<<<<<<<<
*
* logger.handle(record)
*/
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_exc_info, Py_None) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
/* "osd.pyx":108
*
* # create log record and pass it to the Python logger
* record = logging.LogRecord(name = __name__, # <<<<<<<<<<<<<<
* level = loglevel_syslog2py(item.priority),
* pathname = u_file,
*/
__pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_record = __pyx_t_8;
__pyx_t_8 = 0;
/* "osd.pyx":117
* exc_info = None)
*
* logger.handle(record) # <<<<<<<<<<<<<<
*
* free(item)
*/
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_logger, __pyx_n_s_handle); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_6, function);
}
}
__pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_record) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_record);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "osd.pyx":119
* logger.handle(record)
*
* free(item) # <<<<<<<<<<<<<<
*
* return 0
*/
free(__pyx_v_item);
/* "osd.pyx":121
* free(item)
*
* return 0 # <<<<<<<<<<<<<<
*
* cdef loglevel_py2syslog(py_level):
*/
__pyx_r = 0;
goto __pyx_L0;
/* "osd.pyx":77
* Py_AddPendingCall(log_cb_withgil, <void*>item)
*
* cdef int log_cb_withgil(void* item_void) with gil: # <<<<<<<<<<<<<<
* """
* Process a log entry with GIL held
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_WriteUnraisable("osd.log_cb_withgil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_logger);
__Pyx_XDECREF(__pyx_v_u_file);
__Pyx_XDECREF(__pyx_v_u_fn);
__Pyx_XDECREF(__pyx_v_u_msg);
__Pyx_XDECREF(__pyx_v_record);
__Pyx_RefNannyFinishContext();
#ifdef WITH_THREAD
__Pyx_PyGILState_Release(__pyx_gilstate_save);
#endif
return __pyx_r;
}
/* "osd.pyx":123
* return 0
*
* cdef loglevel_py2syslog(py_level): # <<<<<<<<<<<<<<
* """
* Convert Python logging severity levels to syslog levels as defined in
*/
static PyObject *__pyx_f_3osd_loglevel_py2syslog(PyObject *__pyx_v_py_level) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
__Pyx_RefNannySetupContext("loglevel_py2syslog", 0);
/* "osd.pyx":128
* syslog.h
* """
* if py_level == logging.CRITICAL: # <<<<<<<<<<<<<<
* return 2 # LOG_CRIT
* elif py_level == logging.ERROR:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CRITICAL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":129
* """
* if py_level == logging.CRITICAL:
* return 2 # LOG_CRIT # <<<<<<<<<<<<<<
* elif py_level == logging.ERROR:
* return 3 # LOG_ERR
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_2);
__pyx_r = __pyx_int_2;
goto __pyx_L0;
/* "osd.pyx":128
* syslog.h
* """
* if py_level == logging.CRITICAL: # <<<<<<<<<<<<<<
* return 2 # LOG_CRIT
* elif py_level == logging.ERROR:
*/
}
/* "osd.pyx":130
* if py_level == logging.CRITICAL:
* return 2 # LOG_CRIT
* elif py_level == logging.ERROR: # <<<<<<<<<<<<<<
* return 3 # LOG_ERR
* elif py_level == logging.WARNING:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":131
* return 2 # LOG_CRIT
* elif py_level == logging.ERROR:
* return 3 # LOG_ERR # <<<<<<<<<<<<<<
* elif py_level == logging.WARNING:
* return 4 # LOG_WARNING
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_3);
__pyx_r = __pyx_int_3;
goto __pyx_L0;
/* "osd.pyx":130
* if py_level == logging.CRITICAL:
* return 2 # LOG_CRIT
* elif py_level == logging.ERROR: # <<<<<<<<<<<<<<
* return 3 # LOG_ERR
* elif py_level == logging.WARNING:
*/
}
/* "osd.pyx":132
* elif py_level == logging.ERROR:
* return 3 # LOG_ERR
* elif py_level == logging.WARNING: # <<<<<<<<<<<<<<
* return 4 # LOG_WARNING
* elif py_level == logging.INFO:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 132, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":133
* return 3 # LOG_ERR
* elif py_level == logging.WARNING:
* return 4 # LOG_WARNING # <<<<<<<<<<<<<<
* elif py_level == logging.INFO:
* return 6 # LOG_INFO
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_4);
__pyx_r = __pyx_int_4;
goto __pyx_L0;
/* "osd.pyx":132
* elif py_level == logging.ERROR:
* return 3 # LOG_ERR
* elif py_level == logging.WARNING: # <<<<<<<<<<<<<<
* return 4 # LOG_WARNING
* elif py_level == logging.INFO:
*/
}
/* "osd.pyx":134
* elif py_level == logging.WARNING:
* return 4 # LOG_WARNING
* elif py_level == logging.INFO: # <<<<<<<<<<<<<<
* return 6 # LOG_INFO
* elif py_level == logging.DEBUG:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_INFO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 134, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":135
* return 4 # LOG_WARNING
* elif py_level == logging.INFO:
* return 6 # LOG_INFO # <<<<<<<<<<<<<<
* elif py_level == logging.DEBUG:
* return 7 # LOG_DEBUG
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_6);
__pyx_r = __pyx_int_6;
goto __pyx_L0;
/* "osd.pyx":134
* elif py_level == logging.WARNING:
* return 4 # LOG_WARNING
* elif py_level == logging.INFO: # <<<<<<<<<<<<<<
* return 6 # LOG_INFO
* elif py_level == logging.DEBUG:
*/
}
/* "osd.pyx":136
* elif py_level == logging.INFO:
* return 6 # LOG_INFO
* elif py_level == logging.DEBUG: # <<<<<<<<<<<<<<
* return 7 # LOG_DEBUG
* elif py_level == logging.NOTSET:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DEBUG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":137
* return 6 # LOG_INFO
* elif py_level == logging.DEBUG:
* return 7 # LOG_DEBUG # <<<<<<<<<<<<<<
* elif py_level == logging.NOTSET:
* return 0 # LOG_EMERG
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_7);
__pyx_r = __pyx_int_7;
goto __pyx_L0;
/* "osd.pyx":136
* elif py_level == logging.INFO:
* return 6 # LOG_INFO
* elif py_level == logging.DEBUG: # <<<<<<<<<<<<<<
* return 7 # LOG_DEBUG
* elif py_level == logging.NOTSET:
*/
}
/* "osd.pyx":138
* elif py_level == logging.DEBUG:
* return 7 # LOG_DEBUG
* elif py_level == logging.NOTSET: # <<<<<<<<<<<<<<
* return 0 # LOG_EMERG
* else:
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_NOTSET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_RichCompare(__pyx_v_py_level, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 138, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (likely(__pyx_t_3)) {
/* "osd.pyx":139
* return 7 # LOG_DEBUG
* elif py_level == logging.NOTSET:
* return 0 # LOG_EMERG # <<<<<<<<<<<<<<
* else:
* raise Exception("Unknown loglevel " + str(py_level))
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_int_0);
__pyx_r = __pyx_int_0;
goto __pyx_L0;
/* "osd.pyx":138
* elif py_level == logging.DEBUG:
* return 7 # LOG_DEBUG
* elif py_level == logging.NOTSET: # <<<<<<<<<<<<<<
* return 0 # LOG_EMERG
* else:
*/
}
/* "osd.pyx":141
* return 0 # LOG_EMERG
* else:
* raise Exception("Unknown loglevel " + str(py_level)) # <<<<<<<<<<<<<<
*
*
*/
/*else*/ {
__pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_py_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_loglevel, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 141, __pyx_L1_error)
}
/* "osd.pyx":123
* return 0
*
* cdef loglevel_py2syslog(py_level): # <<<<<<<<<<<<<<
* """
* Convert Python logging severity levels to syslog levels as defined in
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("osd.loglevel_py2syslog", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":144
*
*
* cdef loglevel_syslog2py(syslog_level): # <<<<<<<<<<<<<<
* """
* Convert syslog log severity levels, as defined in syslog.h, to Python ones
*/
static PyObject *__pyx_f_3osd_loglevel_syslog2py(PyObject *__pyx_v_syslog_level) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("loglevel_syslog2py", 0);
/* "osd.pyx":148
* Convert syslog log severity levels, as defined in syslog.h, to Python ones
* """
* if syslog_level <= 2: # LOG_EMERG, LOG_ALERT, LOG_CRIT # <<<<<<<<<<<<<<
* return logging.CRITICAL
* elif syslog_level == 3: # LOG_ERR
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_syslog_level, __pyx_int_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 148, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "osd.pyx":149
* """
* if syslog_level <= 2: # LOG_EMERG, LOG_ALERT, LOG_CRIT
* return logging.CRITICAL # <<<<<<<<<<<<<<
* elif syslog_level == 3: # LOG_ERR
* return logging.ERROR
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CRITICAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* "osd.pyx":148
* Convert syslog log severity levels, as defined in syslog.h, to Python ones
* """
* if syslog_level <= 2: # LOG_EMERG, LOG_ALERT, LOG_CRIT # <<<<<<<<<<<<<<
* return logging.CRITICAL
* elif syslog_level == 3: # LOG_ERR
*/
}
/* "osd.pyx":150
* if syslog_level <= 2: # LOG_EMERG, LOG_ALERT, LOG_CRIT
* return logging.CRITICAL
* elif syslog_level == 3: # LOG_ERR # <<<<<<<<<<<<<<
* return logging.ERROR
* elif syslog_level == 4: # LOG_WARNING
*/
__pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_syslog_level, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
/* "osd.pyx":151
* return logging.CRITICAL
* elif syslog_level == 3: # LOG_ERR
* return logging.ERROR # <<<<<<<<<<<<<<
* elif syslog_level == 4: # LOG_WARNING
* return logging.WARNING
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ERROR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":150
* if syslog_level <= 2: # LOG_EMERG, LOG_ALERT, LOG_CRIT
* return logging.CRITICAL
* elif syslog_level == 3: # LOG_ERR # <<<<<<<<<<<<<<
* return logging.ERROR
* elif syslog_level == 4: # LOG_WARNING
*/
}
/* "osd.pyx":152
* elif syslog_level == 3: # LOG_ERR
* return logging.ERROR
* elif syslog_level == 4: # LOG_WARNING # <<<<<<<<<<<<<<
* return logging.WARNING
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
*/
__pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_syslog_level, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "osd.pyx":153
* return logging.ERROR
* elif syslog_level == 4: # LOG_WARNING
* return logging.WARNING # <<<<<<<<<<<<<<
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
* return logging.INFO
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WARNING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* "osd.pyx":152
* elif syslog_level == 3: # LOG_ERR
* return logging.ERROR
* elif syslog_level == 4: # LOG_WARNING # <<<<<<<<<<<<<<
* return logging.WARNING
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
*/
}
/* "osd.pyx":154
* elif syslog_level == 4: # LOG_WARNING
* return logging.WARNING
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO # <<<<<<<<<<<<<<
* return logging.INFO
* elif syslog_level == 7: # LOG_DEBUG
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_syslog_level, __pyx_int_6, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_2) {
/* "osd.pyx":155
* return logging.WARNING
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
* return logging.INFO # <<<<<<<<<<<<<<
* elif syslog_level == 7: # LOG_DEBUG
* return logging.DEBUG
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_INFO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":154
* elif syslog_level == 4: # LOG_WARNING
* return logging.WARNING
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO # <<<<<<<<<<<<<<
* return logging.INFO
* elif syslog_level == 7: # LOG_DEBUG
*/
}
/* "osd.pyx":156
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
* return logging.INFO
* elif syslog_level == 7: # LOG_DEBUG # <<<<<<<<<<<<<<
* return logging.DEBUG
* else:
*/
__pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_syslog_level, __pyx_int_7, 7, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (likely(__pyx_t_2)) {
/* "osd.pyx":157
* return logging.INFO
* elif syslog_level == 7: # LOG_DEBUG
* return logging.DEBUG # <<<<<<<<<<<<<<
* else:
* raise Exception("Unknown loglevel " + str(syslog_level))
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DEBUG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* "osd.pyx":156
* elif syslog_level <= 6: # LOG_NOTICE, LOG_INFO
* return logging.INFO
* elif syslog_level == 7: # LOG_DEBUG # <<<<<<<<<<<<<<
* return logging.DEBUG
* else:
*/
}
/* "osd.pyx":159
* return logging.DEBUG
* else:
* raise Exception("Unknown loglevel " + str(syslog_level)) # <<<<<<<<<<<<<<
*
*
*/
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_syslog_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unknown_loglevel, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 159, __pyx_L1_error)
}
/* "osd.pyx":144
*
*
* cdef loglevel_syslog2py(syslog_level): # <<<<<<<<<<<<<<
* """
* Convert syslog log severity levels, as defined in syslog.h, to Python ones
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.loglevel_syslog2py", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":165
* pass
*
* cdef check_osd_result(rv): # <<<<<<<<<<<<<<
* if rv != 0:
* raise OsdErrorException(rv)
*/
static PyObject *__pyx_f_3osd_check_osd_result(PyObject *__pyx_v_rv) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("check_osd_result", 0);
/* "osd.pyx":166
*
* cdef check_osd_result(rv):
* if rv != 0: # <<<<<<<<<<<<<<
* raise OsdErrorException(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_rv, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 166, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(__pyx_t_2)) {
/* "osd.pyx":167
* cdef check_osd_result(rv):
* if rv != 0:
* raise OsdErrorException(rv) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_OsdErrorException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_rv) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_rv);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 167, __pyx_L1_error)
/* "osd.pyx":166
*
* cdef check_osd_result(rv):
* if rv != 0: # <<<<<<<<<<<<<<
* raise OsdErrorException(rv)
*
*/
}
/* "osd.pyx":165
* pass
*
* cdef check_osd_result(rv): # <<<<<<<<<<<<<<
* if rv != 0:
* raise OsdErrorException(rv)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.check_osd_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":173
* cdef cosd.osd_log_ctx* _cself
*
* def __cinit__(self): # <<<<<<<<<<<<<<
* logger = logging.getLogger(__name__)
* py_loglevel = logger.getEffectiveLevel()
*/
/* Python wrapper */
static int __pyx_pw_3osd_3Log_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_3Log_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_3osd_3Log___cinit__(((struct __pyx_obj_3osd_Log *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_3Log___cinit__(struct __pyx_obj_3osd_Log *__pyx_v_self) {
PyObject *__pyx_v_logger = NULL;
PyObject *__pyx_v_py_loglevel = NULL;
PyObject *__pyx_v_syslog_loglevel = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":174
*
* def __cinit__(self):
* logger = logging.getLogger(__name__) # <<<<<<<<<<<<<<
* py_loglevel = logger.getEffectiveLevel()
* syslog_loglevel = loglevel_py2syslog(py_loglevel)
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_logger = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":175
* def __cinit__(self):
* logger = logging.getLogger(__name__)
* py_loglevel = logger.getEffectiveLevel() # <<<<<<<<<<<<<<
* syslog_loglevel = loglevel_py2syslog(py_loglevel)
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_logger, __pyx_n_s_getEffectiveLevel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_py_loglevel = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":176
* logger = logging.getLogger(__name__)
* py_loglevel = logger.getEffectiveLevel()
* syslog_loglevel = loglevel_py2syslog(py_loglevel) # <<<<<<<<<<<<<<
*
* cosd.osd_log_new(&self._cself, syslog_loglevel, log_cb)
*/
__pyx_t_1 = __pyx_f_3osd_loglevel_py2syslog(__pyx_v_py_loglevel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_syslog_loglevel = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":178
* syslog_loglevel = loglevel_py2syslog(py_loglevel)
*
* cosd.osd_log_new(&self._cself, syslog_loglevel, log_cb) # <<<<<<<<<<<<<<
* if self._cself is NULL:
* raise MemoryError()
*/
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_syslog_loglevel); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
(void)(osd_log_new((&__pyx_v_self->_cself), __pyx_t_5, __pyx_f_3osd_log_cb));
/* "osd.pyx":179
*
* cosd.osd_log_new(&self._cself, syslog_loglevel, log_cb)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_6 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_6)) {
/* "osd.pyx":180
* cosd.osd_log_new(&self._cself, syslog_loglevel, log_cb)
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 180, __pyx_L1_error)
/* "osd.pyx":179
*
* cosd.osd_log_new(&self._cself, syslog_loglevel, log_cb)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":173
* cdef cosd.osd_log_ctx* _cself
*
* def __cinit__(self): # <<<<<<<<<<<<<<
* logger = logging.getLogger(__name__)
* py_loglevel = logger.getEffectiveLevel()
*/
/* function exit code */
__pyx_r = 0;
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_4);
__Pyx_AddTraceback("osd.Log.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_logger);
__Pyx_XDECREF(__pyx_v_py_loglevel);
__Pyx_XDECREF(__pyx_v_syslog_loglevel);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":182
* raise MemoryError()
*
* def __dealloc(self): # <<<<<<<<<<<<<<
* if self._cself is not NULL:
* cosd.osd_log_free(&self._cself)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_3Log_3__dealloc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_3Log_2__dealloc[] = "Log.__dealloc(self)";
static PyObject *__pyx_pw_3osd_3Log_3__dealloc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_3Log_2__dealloc(((struct __pyx_obj_3osd_Log *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_3Log_2__dealloc(struct __pyx_obj_3osd_Log *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc", 0);
/* "osd.pyx":183
*
* def __dealloc(self):
* if self._cself is not NULL: # <<<<<<<<<<<<<<
* cosd.osd_log_free(&self._cself)
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself != NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":184
* def __dealloc(self):
* if self._cself is not NULL:
* cosd.osd_log_free(&self._cself) # <<<<<<<<<<<<<<
*
* class PacketPayloadView(MutableSequence):
*/
osd_log_free((&__pyx_v_self->_cself));
/* "osd.pyx":183
*
* def __dealloc(self):
* if self._cself is not NULL: # <<<<<<<<<<<<<<
* cosd.osd_log_free(&self._cself)
*
*/
}
/* "osd.pyx":182
* raise MemoryError()
*
* def __dealloc(self): # <<<<<<<<<<<<<<
* if self._cself is not NULL:
* cosd.osd_log_free(&self._cself)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_3Log_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_3Log_4__reduce_cython__[] = "Log.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_3Log_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_3Log_4__reduce_cython__(((struct __pyx_obj_3osd_Log *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_3Log_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Log *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Log.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_3Log_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_3Log_6__setstate_cython__[] = "Log.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_3Log_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_3Log_6__setstate_cython__(((struct __pyx_obj_3osd_Log *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_3Log_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Log *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Log.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":191
* PACKET_HEADER_WORD_CNT = 3
*
* def __init__(self, packet): # <<<<<<<<<<<<<<
* self.packet = packet
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView___init__[] = "PacketPayloadView.__init__(self, packet)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_17PacketPayloadView_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_17PacketPayloadView___init__};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_packet = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_packet,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_packet)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 191, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 191, __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_packet = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 191, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_17PacketPayloadView___init__(__pyx_self, __pyx_v_self, __pyx_v_packet);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_packet) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
/* "osd.pyx":192
*
* def __init__(self, packet):
* self.packet = packet # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_packet, __pyx_v_packet) < 0) __PYX_ERR(0, 192, __pyx_L1_error)
/* "osd.pyx":191
* PACKET_HEADER_WORD_CNT = 3
*
* def __init__(self, packet): # <<<<<<<<<<<<<<
* self.packet = packet
*
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":194
* self.packet = packet
*
* def __len__(self): # <<<<<<<<<<<<<<
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_3__len__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView_2__len__[] = "PacketPayloadView.__len__(self)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_3__len__ = {"__len__", (PyCFunction)__pyx_pw_3osd_17PacketPayloadView_3__len__, METH_O, __pyx_doc_3osd_17PacketPayloadView_2__len__};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_3__len__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_17PacketPayloadView_2__len__(__pyx_self, ((PyObject *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView_2__len__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__len__", 0);
/* "osd.pyx":195
*
* def __len__(self):
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT # <<<<<<<<<<<<<<
*
* def __getitem__(self, index):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_packet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PACKET_HEADER_WORD_CNT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "osd.pyx":194
* self.packet = packet
*
* def __len__(self): # <<<<<<<<<<<<<<
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.PacketPayloadView.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":197
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_5__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView_4__getitem__[] = "PacketPayloadView.__getitem__(self, index)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_5__getitem__ = {"__getitem__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_17PacketPayloadView_5__getitem__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_17PacketPayloadView_4__getitem__};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_5__getitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_index = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, 1); __PYX_ERR(0, 197, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__getitem__") < 0)) __PYX_ERR(0, 197, __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_index = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__getitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 197, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_17PacketPayloadView_4__getitem__(__pyx_self, __pyx_v_self, __pyx_v_index);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView_4__getitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "osd.pyx":198
*
* def __getitem__(self, index):
* return self.packet[index + self.PACKET_HEADER_WORD_CNT] # <<<<<<<<<<<<<<
*
* def __setitem__(self, index, value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_packet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PACKET_HEADER_WORD_CNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Add(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* "osd.pyx":197
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketPayloadView.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":200
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_7__setitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView_6__setitem__[] = "PacketPayloadView.__setitem__(self, index, value)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_7__setitem__ = {"__setitem__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_17PacketPayloadView_7__setitem__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_17PacketPayloadView_6__setitem__};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_7__setitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_index = 0;
PyObject *__pyx_v_value = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,&__pyx_n_s_value,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 1); __PYX_ERR(0, 200, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, 2); __PYX_ERR(0, 200, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__setitem__") < 0)) __PYX_ERR(0, 200, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_self = values[0];
__pyx_v_index = values[1];
__pyx_v_value = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__setitem__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 200, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_17PacketPayloadView_6__setitem__(__pyx_self, __pyx_v_self, __pyx_v_index, __pyx_v_value);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView_6__setitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__setitem__", 0);
/* "osd.pyx":201
*
* def __setitem__(self, index, value):
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value # <<<<<<<<<<<<<<
*
* def __delitem__(self, index):
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_packet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PACKET_HEADER_WORD_CNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Add(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_3, __pyx_v_value) < 0)) __PYX_ERR(0, 201, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":200
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
*/
/* function exit code */
__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_AddTraceback("osd.PacketPayloadView.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":203
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_9__delitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView_8__delitem__[] = "PacketPayloadView.__delitem__(self, index)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_9__delitem__ = {"__delitem__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_17PacketPayloadView_9__delitem__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_17PacketPayloadView_8__delitem__};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_9__delitem__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_index = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, 1); __PYX_ERR(0, 203, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__delitem__") < 0)) __PYX_ERR(0, 203, __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_index = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__delitem__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_17PacketPayloadView_8__delitem__(__pyx_self, __pyx_v_self, __pyx_v_index);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView_8__delitem__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__delitem__", 0);
/* "osd.pyx":204
*
* def __delitem__(self, index):
* del self.packet[index + self.PACKET_HEADER_WORD_CNT] # <<<<<<<<<<<<<<
*
* def insert(self, index, value):
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_packet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PACKET_HEADER_WORD_CNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Add(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(PyObject_DelItem(__pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":203
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
/* function exit code */
__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_AddTraceback("osd.PacketPayloadView.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":206
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_17PacketPayloadView_11insert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_17PacketPayloadView_10insert[] = "PacketPayloadView.insert(self, index, value)";
static PyMethodDef __pyx_mdef_3osd_17PacketPayloadView_11insert = {"insert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_17PacketPayloadView_11insert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_17PacketPayloadView_10insert};
static PyObject *__pyx_pw_3osd_17PacketPayloadView_11insert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_index = 0;
PyObject *__pyx_v_value = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("insert (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,&__pyx_n_s_value,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 1); __PYX_ERR(0, 206, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 2); __PYX_ERR(0, 206, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) __PYX_ERR(0, 206, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_self = values[0];
__pyx_v_index = values[1];
__pyx_v_value = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 206, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketPayloadView.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_17PacketPayloadView_10insert(__pyx_self, __pyx_v_self, __pyx_v_index, __pyx_v_value);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_17PacketPayloadView_10insert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
__Pyx_RefNannySetupContext("insert", 0);
/* "osd.pyx":207
*
* def insert(self, index, value):
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value) # <<<<<<<<<<<<<<
*
* cdef class Packet(PacketType, MutableSequence):
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_packet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_insert); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PACKET_HEADER_WORD_CNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyNumber_Add(__pyx_v_index, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
__pyx_t_5 = 0;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(__pyx_t_3)) {
PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_v_value};
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else
#endif
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_v_value};
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else
#endif
{
__pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
if (__pyx_t_2) {
__Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
}
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_4);
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_value);
__pyx_t_4 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":206
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
*/
/* function exit code */
__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_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("osd.PacketPayloadView.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Packet_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_6Packet___reduce_cython__[] = "Packet.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_6Packet_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_6Packet___reduce_cython__(((struct __pyx_obj_3osd_Packet *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Packet___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Packet *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Packet.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Packet_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_6Packet_2__setstate_cython__[] = "Packet.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_6Packet_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_6Packet_2__setstate_cython__(((struct __pyx_obj_3osd_Packet *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Packet_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Packet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Packet.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":220
* cdef cosd.osd_packet* _cself
*
* def _ensure_cself(self): # <<<<<<<<<<<<<<
* if not self._cself:
* cosd.osd_packet_new(&self._cself,
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_1_ensure_cself(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_10PacketType__ensure_cself[] = "PacketType._ensure_cself(self)";
static PyObject *__pyx_pw_3osd_10PacketType_1_ensure_cself(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_ensure_cself (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType__ensure_cself(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType__ensure_cself(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("_ensure_cself", 0);
/* "osd.pyx":221
*
* def _ensure_cself(self):
* if not self._cself: # <<<<<<<<<<<<<<
* cosd.osd_packet_new(&self._cself,
* cosd.osd_packet_sizeconv_payload2data(0))
*/
__pyx_t_1 = ((!(__pyx_v_self->_cself != 0)) != 0);
if (__pyx_t_1) {
/* "osd.pyx":222
* def _ensure_cself(self):
* if not self._cself:
* cosd.osd_packet_new(&self._cself, # <<<<<<<<<<<<<<
* cosd.osd_packet_sizeconv_payload2data(0))
* if self._cself is NULL:
*/
(void)(osd_packet_new((&__pyx_v_self->_cself), osd_packet_sizeconv_payload2data(0)));
/* "osd.pyx":224
* cosd.osd_packet_new(&self._cself,
* cosd.osd_packet_sizeconv_payload2data(0))
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_1)) {
/* "osd.pyx":225
* cosd.osd_packet_sizeconv_payload2data(0))
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 225, __pyx_L1_error)
/* "osd.pyx":224
* cosd.osd_packet_new(&self._cself,
* cosd.osd_packet_sizeconv_payload2data(0))
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":221
*
* def _ensure_cself(self):
* if not self._cself: # <<<<<<<<<<<<<<
* cosd.osd_packet_new(&self._cself,
* cosd.osd_packet_sizeconv_payload2data(0))
*/
}
/* "osd.pyx":220
* cdef cosd.osd_packet* _cself
*
* def _ensure_cself(self): # <<<<<<<<<<<<<<
* if not self._cself:
* cosd.osd_packet_new(&self._cself,
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("osd.PacketType._ensure_cself", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":227
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is not NULL:
* cosd.osd_packet_free(&self._cself)
*/
/* Python wrapper */
static void __pyx_pw_3osd_10PacketType_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_10PacketType_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_10PacketType_2__dealloc__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_10PacketType_2__dealloc__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":228
*
* def __dealloc__(self):
* if self._cself is not NULL: # <<<<<<<<<<<<<<
* cosd.osd_packet_free(&self._cself)
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself != NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":229
* def __dealloc__(self):
* if self._cself is not NULL:
* cosd.osd_packet_free(&self._cself) # <<<<<<<<<<<<<<
*
* # Container API for sequences (lists) with Cython extensions
*/
osd_packet_free((&__pyx_v_self->_cself));
/* "osd.pyx":228
*
* def __dealloc__(self):
* if self._cself is not NULL: # <<<<<<<<<<<<<<
* cosd.osd_packet_free(&self._cself)
*
*/
}
/* "osd.pyx":227
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is not NULL:
* cosd.osd_packet_free(&self._cself)
*/
/* function exit code */
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":237
* # https://docs.python.org/3/library/stdtypes.html#list
*
* def __len__(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return self._cself.data_size_words
*/
/* Python wrapper */
static Py_ssize_t __pyx_pw_3osd_10PacketType_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_3osd_10PacketType_5__len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_4__len__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static Py_ssize_t __pyx_pf_3osd_10PacketType_4__len__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__len__", 0);
/* "osd.pyx":238
*
* def __len__(self):
* self._ensure_cself() # <<<<<<<<<<<<<<
* return self._cself.data_size_words
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __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;
/* "osd.pyx":239
* def __len__(self):
* self._ensure_cself()
* return self._cself.data_size_words # <<<<<<<<<<<<<<
*
* def __getitem__(self, index):
*/
__pyx_r = __pyx_v_self->_cself->data_size_words;
goto __pyx_L0;
/* "osd.pyx":237
* # https://docs.python.org/3/library/stdtypes.html#list
*
* def __len__(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return self._cself.data_size_words
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":241
* return self._cself.data_size_words
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* self._ensure_cself()
* if index >= self._cself.data_size_words:
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_6__getitem__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), ((PyObject *)__pyx_v_index));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_6__getitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index) {
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;
Py_ssize_t __pyx_t_5;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "osd.pyx":242
*
* def __getitem__(self, index):
* self._ensure_cself() # <<<<<<<<<<<<<<
* if index >= self._cself.data_size_words:
* raise IndexError
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __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;
/* "osd.pyx":243
* def __getitem__(self, index):
* self._ensure_cself()
* if index >= self._cself.data_size_words: # <<<<<<<<<<<<<<
* raise IndexError
* return self._cself.data_raw[index]
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_self->_cself->data_size_words); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 243, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(__pyx_t_4)) {
/* "osd.pyx":244
* self._ensure_cself()
* if index >= self._cself.data_size_words:
* raise IndexError # <<<<<<<<<<<<<<
* return self._cself.data_raw[index]
*
*/
__Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
__PYX_ERR(0, 244, __pyx_L1_error)
/* "osd.pyx":243
* def __getitem__(self, index):
* self._ensure_cself()
* if index >= self._cself.data_size_words: # <<<<<<<<<<<<<<
* raise IndexError
* return self._cself.data_raw[index]
*/
}
/* "osd.pyx":245
* if index >= self._cself.data_size_words:
* raise IndexError
* return self._cself.data_raw[index] # <<<<<<<<<<<<<<
*
* def __setitem__(self, index, value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_uint16_t((__pyx_v_self->_cself->data_raw[__pyx_t_5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* "osd.pyx":241
* return self._cself.data_size_words
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* self._ensure_cself()
* if index >= self._cself.data_size_words:
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":247
* return self._cself.data_raw[index]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self._ensure_cself()
* if index >= self._cself.data_size_words:
*/
/* Python wrapper */
static int __pyx_pw_3osd_10PacketType_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_3osd_10PacketType_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_8__setitem__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_10PacketType_8__setitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
uint16_t __pyx_t_5;
Py_ssize_t __pyx_t_6;
__Pyx_RefNannySetupContext("__setitem__", 0);
/* "osd.pyx":248
*
* def __setitem__(self, index, value):
* self._ensure_cself() # <<<<<<<<<<<<<<
* if index >= self._cself.data_size_words:
* raise IndexError
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __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;
/* "osd.pyx":249
* def __setitem__(self, index, value):
* self._ensure_cself()
* if index >= self._cself.data_size_words: # <<<<<<<<<<<<<<
* raise IndexError
* self._cself.data_raw[index] = value
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_self->_cself->data_size_words); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(__pyx_t_4)) {
/* "osd.pyx":250
* self._ensure_cself()
* if index >= self._cself.data_size_words:
* raise IndexError # <<<<<<<<<<<<<<
* self._cself.data_raw[index] = value
*
*/
__Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
__PYX_ERR(0, 250, __pyx_L1_error)
/* "osd.pyx":249
* def __setitem__(self, index, value):
* self._ensure_cself()
* if index >= self._cself.data_size_words: # <<<<<<<<<<<<<<
* raise IndexError
* self._cself.data_raw[index] = value
*/
}
/* "osd.pyx":251
* if index >= self._cself.data_size_words:
* raise IndexError
* self._cself.data_raw[index] = value # <<<<<<<<<<<<<<
*
* def __delitem__(self, index):
*/
__pyx_t_5 = __Pyx_PyInt_As_uint16_t(__pyx_v_value); if (unlikely((__pyx_t_5 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
(__pyx_v_self->_cself->data_raw[__pyx_t_6]) = __pyx_t_5;
/* "osd.pyx":247
* return self._cself.data_raw[index]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self._ensure_cself()
* if index >= self._cself.data_size_words:
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":253
* self._cself.data_raw[index] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* if len(self) <= 3:
* raise ValueError("Packet must have at least 3 (header) words.")
*/
/* Python wrapper */
static int __pyx_pw_3osd_10PacketType_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static int __pyx_pw_3osd_10PacketType_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_10__delitem__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), ((PyObject *)__pyx_v_index));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_10PacketType_10__delitem__(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index) {
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
Py_ssize_t __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
size_t __pyx_t_8;
__Pyx_RefNannySetupContext("__delitem__", 0);
/* "osd.pyx":254
*
* def __delitem__(self, index):
* if len(self) <= 3: # <<<<<<<<<<<<<<
* raise ValueError("Packet must have at least 3 (header) words.")
*
*/
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 254, __pyx_L1_error)
__pyx_t_2 = ((__pyx_t_1 <= 3) != 0);
if (unlikely(__pyx_t_2)) {
/* "osd.pyx":255
* def __delitem__(self, index):
* if len(self) <= 3:
* raise ValueError("Packet must have at least 3 (header) words.") # <<<<<<<<<<<<<<
*
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1],
*/
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 255, __pyx_L1_error)
/* "osd.pyx":254
*
* def __delitem__(self, index):
* if len(self) <= 3: # <<<<<<<<<<<<<<
* raise ValueError("Packet must have at least 3 (header) words.")
*
*/
}
/* "osd.pyx":257
* raise ValueError("Packet must have at least 3 (header) words.")
*
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1], # <<<<<<<<<<<<<<
* (len(self) - index) * sizeof(uint16_t))
* rv = cosd.osd_packet_realloc(&self._cself,
*/
__pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":258
*
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1],
* (len(self) - index) * sizeof(uint16_t)) # <<<<<<<<<<<<<<
* rv = cosd.osd_packet_realloc(&self._cself,
* self._cself.data_size_words - 1)
*/
__pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error)
__pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_v_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(uint16_t))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "osd.pyx":257
* raise ValueError("Packet must have at least 3 (header) words.")
*
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1], # <<<<<<<<<<<<<<
* (len(self) - index) * sizeof(uint16_t))
* rv = cosd.osd_packet_realloc(&self._cself,
*/
(void)(memmove((&(__pyx_v_self->_cself->data_raw[__pyx_t_1])), (&(__pyx_v_self->_cself->data_raw[__pyx_t_4])), __pyx_t_8));
/* "osd.pyx":259
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1],
* (len(self) - index) * sizeof(uint16_t))
* rv = cosd.osd_packet_realloc(&self._cself, # <<<<<<<<<<<<<<
* self._cself.data_size_words - 1)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_packet_realloc((&__pyx_v_self->_cself), (__pyx_v_self->_cself->data_size_words - 1));
/* "osd.pyx":261
* rv = cosd.osd_packet_realloc(&self._cself,
* self._cself.data_size_words - 1)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def insert(self, index, value):
*/
__pyx_t_7 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":253
* self._cself.data_raw[index] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* if len(self) <= 3:
* raise ValueError("Packet must have at least 3 (header) words.")
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("osd.PacketType.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":263
* check_osd_result(rv)
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* """ insert value before index """
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_13insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_10PacketType_12insert[] = "PacketType.insert(self, index, value)\n insert value before index ";
static PyObject *__pyx_pw_3osd_10PacketType_13insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_index = 0;
PyObject *__pyx_v_value = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("insert (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_value,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, 1); __PYX_ERR(0, 263, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "insert") < 0)) __PYX_ERR(0, 263, __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_index = values[0];
__pyx_v_value = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("insert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketType.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_10PacketType_12insert(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), __pyx_v_index, __pyx_v_value);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_12insert(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
PyObject *__pyx_v_old_size_words = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
size_t __pyx_t_2;
int __pyx_t_3;
Py_ssize_t __pyx_t_4;
Py_ssize_t __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
uint16_t __pyx_t_8;
__Pyx_RefNannySetupContext("insert", 0);
/* "osd.pyx":266
* """ insert value before index """
*
* old_size_words = self._cself.data_size_words # <<<<<<<<<<<<<<
*
* # enlarge packet by one word
*/
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_self->_cself->data_size_words); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_old_size_words = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":269
*
* # enlarge packet by one word
* cosd.osd_packet_realloc(&self._cself, old_size_words + 1) # <<<<<<<<<<<<<<
*
* # move existing elements out of the way (if any)
*/
__pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_old_size_words, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
(void)(osd_packet_realloc((&__pyx_v_self->_cself), __pyx_t_2));
/* "osd.pyx":272
*
* # move existing elements out of the way (if any)
* if index < old_size_words: # <<<<<<<<<<<<<<
* memmove(&self._cself.data_raw[index + 1],
* &self._cself.data_raw[index], (old_size_words - index) * sizeof(uint16_t))
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_v_old_size_words, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_3) {
/* "osd.pyx":273
* # move existing elements out of the way (if any)
* if index < old_size_words:
* memmove(&self._cself.data_raw[index + 1], # <<<<<<<<<<<<<<
* &self._cself.data_raw[index], (old_size_words - index) * sizeof(uint16_t))
*
*/
__pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":274
* if index < old_size_words:
* memmove(&self._cself.data_raw[index + 1],
* &self._cself.data_raw[index], (old_size_words - index) * sizeof(uint16_t)) # <<<<<<<<<<<<<<
*
* # set value
*/
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
__pyx_t_1 = PyNumber_Subtract(__pyx_v_old_size_words, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(uint16_t))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 274, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 274, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "osd.pyx":273
* # move existing elements out of the way (if any)
* if index < old_size_words:
* memmove(&self._cself.data_raw[index + 1], # <<<<<<<<<<<<<<
* &self._cself.data_raw[index], (old_size_words - index) * sizeof(uint16_t))
*
*/
(void)(memmove((&(__pyx_v_self->_cself->data_raw[__pyx_t_4])), (&(__pyx_v_self->_cself->data_raw[__pyx_t_5])), __pyx_t_2));
/* "osd.pyx":272
*
* # move existing elements out of the way (if any)
* if index < old_size_words: # <<<<<<<<<<<<<<
* memmove(&self._cself.data_raw[index + 1],
* &self._cself.data_raw[index], (old_size_words - index) * sizeof(uint16_t))
*/
}
/* "osd.pyx":277
*
* # set value
* self._cself.data_raw[index] = value # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_8 = __Pyx_PyInt_As_uint16_t(__pyx_v_value); if (unlikely((__pyx_t_8 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error)
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error)
(__pyx_v_self->_cself->data_raw[__pyx_t_5]) = __pyx_t_8;
/* "osd.pyx":263
* check_osd_result(rv)
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* """ insert value before index """
*
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("osd.PacketType.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_old_size_words);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":280
*
* @property
* def src(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_src(self._cself)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_3src_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_3src_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_3src___get__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_3src___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":281
* @property
* def src(self):
* self._ensure_cself() # <<<<<<<<<<<<<<
* return cosd.osd_packet_get_src(self._cself)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __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;
/* "osd.pyx":282
* def src(self):
* self._ensure_cself()
* return cosd.osd_packet_get_src(self._cself) # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(osd_packet_get_src(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":280
*
* @property
* def src(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_src(self._cself)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.src.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":285
*
* @property
* def dest(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_dest(self._cself)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_4dest_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_4dest_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_4dest___get__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_4dest___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":286
* @property
* def dest(self):
* self._ensure_cself() # <<<<<<<<<<<<<<
* return cosd.osd_packet_get_dest(self._cself)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __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;
/* "osd.pyx":287
* def dest(self):
* self._ensure_cself()
* return cosd.osd_packet_get_dest(self._cself) # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(osd_packet_get_dest(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":285
*
* @property
* def dest(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_dest(self._cself)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.dest.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":290
*
* @property
* def type(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_type(self._cself)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_4type_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_4type___get__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_4type___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":291
* @property
* def type(self):
* self._ensure_cself() # <<<<<<<<<<<<<<
* return cosd.osd_packet_get_type(self._cself)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __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;
/* "osd.pyx":292
* def type(self):
* self._ensure_cself()
* return cosd.osd_packet_get_type(self._cself) # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(osd_packet_get_type(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":290
*
* @property
* def type(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_type(self._cself)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":295
*
* @property
* def type_sub(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_type_sub(self._cself)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_8type_sub_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_8type_sub_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_8type_sub___get__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_8type_sub___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":296
* @property
* def type_sub(self):
* self._ensure_cself() # <<<<<<<<<<<<<<
* return cosd.osd_packet_get_type_sub(self._cself)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __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;
/* "osd.pyx":297
* def type_sub(self):
* self._ensure_cself()
* return cosd.osd_packet_get_type_sub(self._cself) # <<<<<<<<<<<<<<
*
* def set_header(self, dest, src, type, type_sub):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(osd_packet_get_type_sub(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":295
*
* @property
* def type_sub(self): # <<<<<<<<<<<<<<
* self._ensure_cself()
* return cosd.osd_packet_get_type_sub(self._cself)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.type_sub.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":299
* return cosd.osd_packet_get_type_sub(self._cself)
*
* def set_header(self, dest, src, type, type_sub): # <<<<<<<<<<<<<<
* self._ensure_cself()
* cosd.osd_packet_set_header(self._cself, dest, src, type, type_sub)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_15set_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_10PacketType_14set_header[] = "PacketType.set_header(self, dest, src, type, type_sub)";
static PyObject *__pyx_pw_3osd_10PacketType_15set_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_dest = 0;
PyObject *__pyx_v_src = 0;
PyObject *__pyx_v_type = 0;
PyObject *__pyx_v_type_sub = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_header (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dest,&__pyx_n_s_src,&__pyx_n_s_type,&__pyx_n_s_type_sub,0};
PyObject* values[4] = {0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_header", 1, 4, 4, 1); __PYX_ERR(0, 299, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_header", 1, 4, 4, 2); __PYX_ERR(0, 299, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type_sub)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("set_header", 1, 4, 4, 3); __PYX_ERR(0, 299, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_header") < 0)) __PYX_ERR(0, 299, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
}
__pyx_v_dest = values[0];
__pyx_v_src = values[1];
__pyx_v_type = values[2];
__pyx_v_type_sub = values[3];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("set_header", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 299, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.PacketType.set_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_10PacketType_14set_header(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), __pyx_v_dest, __pyx_v_src, __pyx_v_type, __pyx_v_type_sub);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_14set_header(struct __pyx_obj_3osd_PacketType *__pyx_v_self, PyObject *__pyx_v_dest, PyObject *__pyx_v_src, PyObject *__pyx_v_type, PyObject *__pyx_v_type_sub) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
unsigned int __pyx_t_4;
unsigned int __pyx_t_5;
enum osd_packet_type __pyx_t_6;
unsigned int __pyx_t_7;
__Pyx_RefNannySetupContext("set_header", 0);
/* "osd.pyx":300
*
* def set_header(self, dest, src, type, type_sub):
* self._ensure_cself() # <<<<<<<<<<<<<<
* cosd.osd_packet_set_header(self._cself, dest, src, type, type_sub)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __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;
/* "osd.pyx":301
* def set_header(self, dest, src, type, type_sub):
* self._ensure_cself()
* cosd.osd_packet_set_header(self._cself, dest, src, type, type_sub) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_dest); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)
__pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_v_src); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)
__pyx_t_6 = ((enum osd_packet_type)__Pyx_PyInt_As_enum__osd_packet_type(__pyx_v_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)
__pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_v_type_sub); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)
(void)(osd_packet_set_header(__pyx_v_self->_cself, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7));
/* "osd.pyx":299
* return cosd.osd_packet_get_type_sub(self._cself)
*
* def set_header(self, dest, src, type, type_sub): # <<<<<<<<<<<<<<
* self._ensure_cself()
* cosd.osd_packet_set_header(self._cself, dest, src, type, type_sub)
*/
/* function exit code */
__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_AddTraceback("osd.PacketType.set_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":304
*
* @property
* def payload(self): # <<<<<<<<<<<<<<
* return PacketPayloadView(self)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_7payload_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_7payload_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_7payload___get__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_7payload___get__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":305
* @property
* def payload(self):
* return PacketPayloadView(self) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PacketPayloadView); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":304
*
* @property
* def payload(self): # <<<<<<<<<<<<<<
* return PacketPayloadView(self)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.payload.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":307
* return PacketPayloadView(self)
*
* def __str__(self): # <<<<<<<<<<<<<<
* cdef char* c_str = NULL
* self._ensure_cself()
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_17__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_10PacketType_17__str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_16__str__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_16__str__(struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
char *__pyx_v_c_str;
PyObject *__pyx_v_py_u_str = 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;
char const *__pyx_t_6;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
__Pyx_RefNannySetupContext("__str__", 0);
/* "osd.pyx":308
*
* def __str__(self):
* cdef char* c_str = NULL # <<<<<<<<<<<<<<
* self._ensure_cself()
* cosd.osd_packet_to_string(self._cself, &c_str)
*/
__pyx_v_c_str = NULL;
/* "osd.pyx":309
* def __str__(self):
* cdef char* c_str = NULL
* self._ensure_cself() # <<<<<<<<<<<<<<
* cosd.osd_packet_to_string(self._cself, &c_str)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ensure_cself); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __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;
/* "osd.pyx":310
* cdef char* c_str = NULL
* self._ensure_cself()
* cosd.osd_packet_to_string(self._cself, &c_str) # <<<<<<<<<<<<<<
*
* try:
*/
osd_packet_to_string(__pyx_v_self->_cself, (&__pyx_v_c_str));
/* "osd.pyx":312
* cosd.osd_packet_to_string(self._cself, &c_str)
*
* try: # <<<<<<<<<<<<<<
* py_u_str = c_str.decode('UTF-8')
* finally:
*/
/*try:*/ {
/* "osd.pyx":313
*
* try:
* py_u_str = c_str.decode('UTF-8') # <<<<<<<<<<<<<<
* finally:
* free(c_str)
*/
__pyx_t_1 = __Pyx_decode_c_string(__pyx_v_c_str, 0, strlen(__pyx_v_c_str), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_py_u_str = __pyx_t_1;
__pyx_t_1 = 0;
}
/* "osd.pyx":315
* py_u_str = c_str.decode('UTF-8')
* finally:
* free(c_str) # <<<<<<<<<<<<<<
*
* return py_u_str
*/
/*finally:*/ {
/*normal exit:*/{
free(__pyx_v_c_str);
goto __pyx_L5;
}
__pyx_L4_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_11);
__Pyx_XGOTREF(__pyx_t_12);
__pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
{
free(__pyx_v_c_str);
}
if (PY_MAJOR_VERSION >= 3) {
__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_XGIVEREF(__pyx_t_7);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
__pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
goto __pyx_L1_error;
}
__pyx_L5:;
}
/* "osd.pyx":317
* free(c_str)
*
* return py_u_str # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_py_u_str);
__pyx_r = __pyx_v_py_u_str;
goto __pyx_L0;
/* "osd.pyx":307
* return PacketPayloadView(self)
*
* def __str__(self): # <<<<<<<<<<<<<<
* cdef char* c_str = NULL
* self._ensure_cself()
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.PacketType.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_u_str);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_10PacketType_18__reduce_cython__[] = "PacketType.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_10PacketType_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_18__reduce_cython__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_PacketType *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.PacketType.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_10PacketType_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_10PacketType_20__setstate_cython__[] = "PacketType.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_10PacketType_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_10PacketType_20__setstate_cython__(((struct __pyx_obj_3osd_PacketType *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_10PacketType_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_PacketType *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.PacketType.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":323
* cdef cosd.osd_hostmod_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address, *args, **kwargs): # <<<<<<<<<<<<<<
* # *args and **kwargs enables child classes to have more constructor
* # parameters
*/
/* Python wrapper */
static int __pyx_pw_3osd_7Hostmod_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_7Hostmod_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_host_controller_address = 0;
CYTHON_UNUSED PyObject *__pyx_v_args = 0;
CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
__pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
__Pyx_GOTREF(__pyx_v_kwargs);
if (PyTuple_GET_SIZE(__pyx_args) > 2) {
__pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
if (unlikely(!__pyx_v_args)) {
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
__Pyx_RefNannyFinishContext();
return -1;
}
__Pyx_GOTREF(__pyx_v_args);
} else {
__pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
}
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_host_controller_address,0};
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) {
default:
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host_controller_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, 1); __PYX_ERR(0, 323, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 323, __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_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_host_controller_address = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 323, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
__Pyx_AddTraceback("osd.Hostmod.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 323, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_7Hostmod___cinit__(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_log, __pyx_v_host_controller_address, __pyx_v_args, __pyx_v_kwargs);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_args);
__Pyx_XDECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_7Hostmod___cinit__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
PyObject *__pyx_v_py_byte_string = NULL;
char *__pyx_v_c_host_controller_address;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char *__pyx_t_4;
int __pyx_t_5;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":326
* # *args and **kwargs enables child classes to have more constructor
* # parameters
* py_byte_string = host_controller_address.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_host_controller_address = py_byte_string
* cosd.osd_hostmod_new(&self._cself, log._cself, c_host_controller_address,
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host_controller_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_py_byte_string = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":327
* # parameters
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string # <<<<<<<<<<<<<<
* cosd.osd_hostmod_new(&self._cself, log._cself, c_host_controller_address,
* NULL, NULL)
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error)
__pyx_v_c_host_controller_address = __pyx_t_4;
/* "osd.pyx":328
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string
* cosd.osd_hostmod_new(&self._cself, log._cself, c_host_controller_address, # <<<<<<<<<<<<<<
* NULL, NULL)
* # XXX: extend to pass event callback
*/
(void)(osd_hostmod_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_v_c_host_controller_address, NULL, NULL));
/* "osd.pyx":331
* NULL, NULL)
* # XXX: extend to pass event callback
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_5 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_5)) {
/* "osd.pyx":332
* # XXX: extend to pass event callback
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 332, __pyx_L1_error)
/* "osd.pyx":331
* NULL, NULL)
* # XXX: extend to pass event callback
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":323
* cdef cosd.osd_hostmod_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address, *args, **kwargs): # <<<<<<<<<<<<<<
* # *args and **kwargs enables child classes to have more constructor
* # parameters
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.Hostmod.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_byte_string);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":334
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_7Hostmod_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_7Hostmod_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_7Hostmod_2__dealloc__(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_7Hostmod_2__dealloc__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
CYTHON_UNUSED osd_result __pyx_v_rv;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":335
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":336
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* # don't call python methods in here, as they might be partially
*/
goto __pyx_L0;
/* "osd.pyx":335
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":340
* # don't call python methods in here, as they might be partially
* # destructed already
* if cosd.osd_hostmod_is_connected(self._cself): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_disconnect(self._cself)
*
*/
__pyx_t_1 = (osd_hostmod_is_connected(__pyx_v_self->_cself) != 0);
if (__pyx_t_1) {
/* "osd.pyx":341
* # destructed already
* if cosd.osd_hostmod_is_connected(self._cself):
* rv = cosd.osd_hostmod_disconnect(self._cself) # <<<<<<<<<<<<<<
*
* cosd.osd_hostmod_free(&self._cself)
*/
__pyx_v_rv = osd_hostmod_disconnect(__pyx_v_self->_cself);
/* "osd.pyx":340
* # don't call python methods in here, as they might be partially
* # destructed already
* if cosd.osd_hostmod_is_connected(self._cself): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_disconnect(self._cself)
*
*/
}
/* "osd.pyx":343
* rv = cosd.osd_hostmod_disconnect(self._cself)
*
* cosd.osd_hostmod_free(&self._cself) # <<<<<<<<<<<<<<
*
* def connect(self):
*/
osd_hostmod_free((&__pyx_v_self->_cself));
/* "osd.pyx":334
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":345
* cosd.osd_hostmod_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* cosd.osd_hostmod_connect(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_7Hostmod_4connect[] = "Hostmod.connect(self)";
static PyObject *__pyx_pw_3osd_7Hostmod_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_4connect(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_4connect(struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect", 0);
/* "osd.pyx":346
*
* def connect(self):
* cosd.osd_hostmod_connect(self._cself) # <<<<<<<<<<<<<<
*
* def disconnect(self):
*/
(void)(osd_hostmod_connect(__pyx_v_self->_cself));
/* "osd.pyx":345
* cosd.osd_hostmod_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* cosd.osd_hostmod_connect(self._cself)
*
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":348
* cosd.osd_hostmod_connect(self._cself)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* cosd.osd_hostmod_disconnect(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_7Hostmod_6disconnect[] = "Hostmod.disconnect(self)";
static PyObject *__pyx_pw_3osd_7Hostmod_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_6disconnect(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_6disconnect(struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect", 0);
/* "osd.pyx":349
*
* def disconnect(self):
* cosd.osd_hostmod_disconnect(self._cself) # <<<<<<<<<<<<<<
*
* def is_connected(self):
*/
(void)(osd_hostmod_disconnect(__pyx_v_self->_cself));
/* "osd.pyx":348
* cosd.osd_hostmod_connect(self._cself)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* cosd.osd_hostmod_disconnect(self._cself)
*
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":351
* cosd.osd_hostmod_disconnect(self._cself)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostmod_is_connected(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_7Hostmod_8is_connected[] = "Hostmod.is_connected(self)";
static PyObject *__pyx_pw_3osd_7Hostmod_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_8is_connected(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_8is_connected(struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_connected", 0);
/* "osd.pyx":352
*
* def is_connected(self):
* return cosd.osd_hostmod_is_connected(self._cself) # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_hostmod_is_connected(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":351
* cosd.osd_hostmod_disconnect(self._cself)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostmod_is_connected(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostmod.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":355
*
* @property
* def diaddr(self): # <<<<<<<<<<<<<<
* if not self.is_connected:
* return None
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_6diaddr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_7Hostmod_6diaddr_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_6diaddr___get__(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_6diaddr___get__(struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":356
* @property
* def diaddr(self):
* if not self.is_connected: # <<<<<<<<<<<<<<
* return None
*
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_connected); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = ((!__pyx_t_2) != 0);
if (__pyx_t_3) {
/* "osd.pyx":357
* def diaddr(self):
* if not self.is_connected:
* return None # <<<<<<<<<<<<<<
*
* return cosd.osd_hostmod_get_diaddr(self._cself)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
/* "osd.pyx":356
* @property
* def diaddr(self):
* if not self.is_connected: # <<<<<<<<<<<<<<
* return None
*
*/
}
/* "osd.pyx":359
* return None
*
* return cosd.osd_hostmod_get_diaddr(self._cself) # <<<<<<<<<<<<<<
*
* def reg_read(self, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(osd_hostmod_get_diaddr(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":355
*
* @property
* def diaddr(self): # <<<<<<<<<<<<<<
* if not self.is_connected:
* return None
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostmod.diaddr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":361
* return cosd.osd_hostmod_get_diaddr(self._cself)
*
* def reg_read(self, diaddr, reg_addr, reg_size_bit = 16, flags = 0): # <<<<<<<<<<<<<<
* cdef uint16_t outvalue
* if reg_size_bit != 16:
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_11reg_read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_7Hostmod_10reg_read[] = "Hostmod.reg_read(self, diaddr, reg_addr, reg_size_bit=16, flags=0)";
static PyObject *__pyx_pw_3osd_7Hostmod_11reg_read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_diaddr = 0;
PyObject *__pyx_v_reg_addr = 0;
PyObject *__pyx_v_reg_size_bit = 0;
PyObject *__pyx_v_flags = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reg_read (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diaddr,&__pyx_n_s_reg_addr,&__pyx_n_s_reg_size_bit,&__pyx_n_s_flags,0};
PyObject* values[4] = {0,0,0,0};
values[2] = ((PyObject *)__pyx_int_16);
values[3] = ((PyObject *)__pyx_int_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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diaddr)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("reg_read", 0, 2, 4, 1); __PYX_ERR(0, 361, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg_size_bit);
if (value) { values[2] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
if (value) { values[3] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reg_read") < 0)) __PYX_ERR(0, 361, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_diaddr = values[0];
__pyx_v_reg_addr = values[1];
__pyx_v_reg_size_bit = values[2];
__pyx_v_flags = values[3];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("reg_read", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 361, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostmod.reg_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_7Hostmod_10reg_read(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_diaddr, __pyx_v_reg_addr, __pyx_v_reg_size_bit, __pyx_v_flags);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_10reg_read(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_diaddr, PyObject *__pyx_v_reg_addr, PyObject *__pyx_v_reg_size_bit, PyObject *__pyx_v_flags) {
uint16_t __pyx_v_outvalue;
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
uint16_t __pyx_t_3;
uint16_t __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
__Pyx_RefNannySetupContext("reg_read", 0);
/* "osd.pyx":363
* def reg_read(self, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
* cdef uint16_t outvalue
* if reg_size_bit != 16: # <<<<<<<<<<<<<<
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
*/
__pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_reg_size_bit, __pyx_int_16, 16, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(__pyx_t_2)) {
/* "osd.pyx":364
* cdef uint16_t outvalue
* if reg_size_bit != 16:
* raise Exception("XXX: Extend to support other sizes than 16 bit registers") # <<<<<<<<<<<<<<
*
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr,
*/
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 364, __pyx_L1_error)
/* "osd.pyx":363
* def reg_read(self, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
* cdef uint16_t outvalue
* if reg_size_bit != 16: # <<<<<<<<<<<<<<
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
*/
}
/* "osd.pyx":366
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr, # <<<<<<<<<<<<<<
* reg_size_bit, flags)
* check_osd_result(rv)
*/
__pyx_t_3 = __Pyx_PyInt_As_uint16_t(__pyx_v_diaddr); if (unlikely((__pyx_t_3 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyInt_As_uint16_t(__pyx_v_reg_addr); if (unlikely((__pyx_t_4 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error)
/* "osd.pyx":367
*
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr,
* reg_size_bit, flags) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_reg_size_bit); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error)
/* "osd.pyx":366
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr, # <<<<<<<<<<<<<<
* reg_size_bit, flags)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_hostmod_reg_read(__pyx_v_self->_cself, (&__pyx_v_outvalue), __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);
/* "osd.pyx":368
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr,
* reg_size_bit, flags)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* return outvalue
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 368, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "osd.pyx":370
* check_osd_result(rv)
*
* return outvalue # <<<<<<<<<<<<<<
*
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_7 = __Pyx_PyInt_From_uint16_t(__pyx_v_outvalue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_r = __pyx_t_7;
__pyx_t_7 = 0;
goto __pyx_L0;
/* "osd.pyx":361
* return cosd.osd_hostmod_get_diaddr(self._cself)
*
* def reg_read(self, diaddr, reg_addr, reg_size_bit = 16, flags = 0): # <<<<<<<<<<<<<<
* cdef uint16_t outvalue
* if reg_size_bit != 16:
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("osd.Hostmod.reg_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":372
* return outvalue
*
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0): # <<<<<<<<<<<<<<
* if reg_size_bit != 16:
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_13reg_write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_7Hostmod_12reg_write[] = "Hostmod.reg_write(self, data, diaddr, reg_addr, reg_size_bit=16, flags=0)";
static PyObject *__pyx_pw_3osd_7Hostmod_13reg_write(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_data = 0;
PyObject *__pyx_v_diaddr = 0;
PyObject *__pyx_v_reg_addr = 0;
PyObject *__pyx_v_reg_size_bit = 0;
PyObject *__pyx_v_flags = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reg_write (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_diaddr,&__pyx_n_s_reg_addr,&__pyx_n_s_reg_size_bit,&__pyx_n_s_flags,0};
PyObject* values[5] = {0,0,0,0,0};
values[3] = ((PyObject *)__pyx_int_16);
values[4] = ((PyObject *)__pyx_int_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 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_diaddr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("reg_write", 0, 3, 5, 1); __PYX_ERR(0, 372, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("reg_write", 0, 3, 5, 2); __PYX_ERR(0, 372, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg_size_bit);
if (value) { values[3] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
if (value) { values[4] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reg_write") < 0)) __PYX_ERR(0, 372, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_data = values[0];
__pyx_v_diaddr = values[1];
__pyx_v_reg_addr = values[2];
__pyx_v_reg_size_bit = values[3];
__pyx_v_flags = values[4];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("reg_write", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 372, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostmod.reg_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_7Hostmod_12reg_write(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_data, __pyx_v_diaddr, __pyx_v_reg_addr, __pyx_v_reg_size_bit, __pyx_v_flags);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_12reg_write(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_diaddr, PyObject *__pyx_v_reg_addr, PyObject *__pyx_v_reg_size_bit, PyObject *__pyx_v_flags) {
uint16_t __pyx_v_c_data;
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
uint16_t __pyx_t_3;
uint16_t __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
__Pyx_RefNannySetupContext("reg_write", 0);
/* "osd.pyx":373
*
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
* if reg_size_bit != 16: # <<<<<<<<<<<<<<
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
*/
__pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_reg_size_bit, __pyx_int_16, 16, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 373, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(__pyx_t_2)) {
/* "osd.pyx":374
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
* if reg_size_bit != 16:
* raise Exception("XXX: Extend to support other sizes than 16 bit registers") # <<<<<<<<<<<<<<
*
* cdef uint16_t c_data = data
*/
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 374, __pyx_L1_error)
/* "osd.pyx":373
*
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0):
* if reg_size_bit != 16: # <<<<<<<<<<<<<<
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
*/
}
/* "osd.pyx":376
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*
* cdef uint16_t c_data = data # <<<<<<<<<<<<<<
*
* rv = cosd.osd_hostmod_reg_write(self._cself, &c_data, diaddr, reg_addr,
*/
__pyx_t_3 = __Pyx_PyInt_As_uint16_t(__pyx_v_data); if (unlikely((__pyx_t_3 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L1_error)
__pyx_v_c_data = __pyx_t_3;
/* "osd.pyx":378
* cdef uint16_t c_data = data
*
* rv = cosd.osd_hostmod_reg_write(self._cself, &c_data, diaddr, reg_addr, # <<<<<<<<<<<<<<
* reg_size_bit, flags)
* check_osd_result(rv)
*/
__pyx_t_3 = __Pyx_PyInt_As_uint16_t(__pyx_v_diaddr); if (unlikely((__pyx_t_3 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyInt_As_uint16_t(__pyx_v_reg_addr); if (unlikely((__pyx_t_4 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error)
/* "osd.pyx":379
*
* rv = cosd.osd_hostmod_reg_write(self._cself, &c_data, diaddr, reg_addr,
* reg_size_bit, flags) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_reg_size_bit); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error)
/* "osd.pyx":378
* cdef uint16_t c_data = data
*
* rv = cosd.osd_hostmod_reg_write(self._cself, &c_data, diaddr, reg_addr, # <<<<<<<<<<<<<<
* reg_size_bit, flags)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_hostmod_reg_write(__pyx_v_self->_cself, (&__pyx_v_c_data), __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);
/* "osd.pyx":380
* rv = cosd.osd_hostmod_reg_write(self._cself, &c_data, diaddr, reg_addr,
* reg_size_bit, flags)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def get_modules(self, subnet_addr):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "osd.pyx":372
* return outvalue
*
* def reg_write(self, data, diaddr, reg_addr, reg_size_bit = 16, flags = 0): # <<<<<<<<<<<<<<
* if reg_size_bit != 16:
* raise Exception("XXX: Extend to support other sizes than 16 bit registers")
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("osd.Hostmod.reg_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":382
* check_osd_result(rv)
*
* def get_modules(self, subnet_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_module_desc *modules = NULL
* cdef size_t modules_len = 0
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_15get_modules(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /*proto*/
static char __pyx_doc_3osd_7Hostmod_14get_modules[] = "Hostmod.get_modules(self, subnet_addr)";
static PyObject *__pyx_pw_3osd_7Hostmod_15get_modules(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_modules (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_14get_modules(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), ((PyObject *)__pyx_v_subnet_addr));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_14get_modules(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
struct osd_module_desc *__pyx_v_modules;
size_t __pyx_v_modules_len;
osd_result __pyx_v_rv;
PyObject *__pyx_v_result_list = NULL;
size_t __pyx_v_m;
PyObject *__pyx_v_mod_desc = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
size_t __pyx_t_4;
size_t __pyx_t_5;
size_t __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
char const *__pyx_t_10;
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
PyObject *__pyx_t_14 = NULL;
PyObject *__pyx_t_15 = NULL;
PyObject *__pyx_t_16 = NULL;
__Pyx_RefNannySetupContext("get_modules", 0);
/* "osd.pyx":383
*
* def get_modules(self, subnet_addr):
* cdef cosd.osd_module_desc *modules = NULL # <<<<<<<<<<<<<<
* cdef size_t modules_len = 0
* try:
*/
__pyx_v_modules = NULL;
/* "osd.pyx":384
* def get_modules(self, subnet_addr):
* cdef cosd.osd_module_desc *modules = NULL
* cdef size_t modules_len = 0 # <<<<<<<<<<<<<<
* try:
* rv = cosd.osd_hostmod_get_modules(self._cself, subnet_addr,
*/
__pyx_v_modules_len = 0;
/* "osd.pyx":385
* cdef cosd.osd_module_desc *modules = NULL
* cdef size_t modules_len = 0
* try: # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_get_modules(self._cself, subnet_addr,
* &modules, &modules_len)
*/
/*try:*/ {
/* "osd.pyx":386
* cdef size_t modules_len = 0
* try:
* rv = cosd.osd_hostmod_get_modules(self._cself, subnet_addr, # <<<<<<<<<<<<<<
* &modules, &modules_len)
* check_osd_result(rv)
*/
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_subnet_addr); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 386, __pyx_L4_error)
/* "osd.pyx":387
* try:
* rv = cosd.osd_hostmod_get_modules(self._cself, subnet_addr,
* &modules, &modules_len) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_hostmod_get_modules(__pyx_v_self->_cself, __pyx_t_1, (&__pyx_v_modules), (&__pyx_v_modules_len));
/* "osd.pyx":388
* rv = cosd.osd_hostmod_get_modules(self._cself, subnet_addr,
* &modules, &modules_len)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* result_list = []
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":390
* check_osd_result(rv)
*
* result_list = [] # <<<<<<<<<<<<<<
* for m in range(modules_len):
* mod_desc = {}
*/
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_result_list = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":391
*
* result_list = []
* for m in range(modules_len): # <<<<<<<<<<<<<<
* mod_desc = {}
* mod_desc['addr'] = modules[m].addr
*/
__pyx_t_4 = __pyx_v_modules_len;
__pyx_t_5 = __pyx_t_4;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_m = __pyx_t_6;
/* "osd.pyx":392
* result_list = []
* for m in range(modules_len):
* mod_desc = {} # <<<<<<<<<<<<<<
* mod_desc['addr'] = modules[m].addr
* mod_desc['vendor'] = modules[m].vendor
*/
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_mod_desc, ((PyObject*)__pyx_t_3));
__pyx_t_3 = 0;
/* "osd.pyx":393
* for m in range(modules_len):
* mod_desc = {}
* mod_desc['addr'] = modules[m].addr # <<<<<<<<<<<<<<
* mod_desc['vendor'] = modules[m].vendor
* mod_desc['type'] = modules[m].type
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t((__pyx_v_modules[__pyx_v_m]).addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_addr, __pyx_t_3) < 0)) __PYX_ERR(0, 393, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":394
* mod_desc = {}
* mod_desc['addr'] = modules[m].addr
* mod_desc['vendor'] = modules[m].vendor # <<<<<<<<<<<<<<
* mod_desc['type'] = modules[m].type
* mod_desc['version'] = modules[m].version
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t((__pyx_v_modules[__pyx_v_m]).vendor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_vendor, __pyx_t_3) < 0)) __PYX_ERR(0, 394, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":395
* mod_desc['addr'] = modules[m].addr
* mod_desc['vendor'] = modules[m].vendor
* mod_desc['type'] = modules[m].type # <<<<<<<<<<<<<<
* mod_desc['version'] = modules[m].version
* result_list.append(mod_desc)
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t((__pyx_v_modules[__pyx_v_m]).type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_type, __pyx_t_3) < 0)) __PYX_ERR(0, 395, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":396
* mod_desc['vendor'] = modules[m].vendor
* mod_desc['type'] = modules[m].type
* mod_desc['version'] = modules[m].version # <<<<<<<<<<<<<<
* result_list.append(mod_desc)
* finally:
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t((__pyx_v_modules[__pyx_v_m]).version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_version, __pyx_t_3) < 0)) __PYX_ERR(0, 396, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":397
* mod_desc['type'] = modules[m].type
* mod_desc['version'] = modules[m].version
* result_list.append(mod_desc) # <<<<<<<<<<<<<<
* finally:
* free(modules)
*/
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result_list, __pyx_v_mod_desc); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 397, __pyx_L4_error)
}
}
/* "osd.pyx":399
* result_list.append(mod_desc)
* finally:
* free(modules) # <<<<<<<<<<<<<<
*
* return result_list
*/
/*finally:*/ {
/*normal exit:*/{
free(__pyx_v_modules);
goto __pyx_L5;
}
__pyx_L4_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
__Pyx_XGOTREF(__pyx_t_11);
__Pyx_XGOTREF(__pyx_t_12);
__Pyx_XGOTREF(__pyx_t_13);
__Pyx_XGOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
{
free(__pyx_v_modules);
}
if (PY_MAJOR_VERSION >= 3) {
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
}
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
__pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
goto __pyx_L1_error;
}
__pyx_L5:;
}
/* "osd.pyx":401
* free(modules)
*
* return result_list # <<<<<<<<<<<<<<
*
* def mod_describe(self, di_addr):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_result_list);
__pyx_r = __pyx_v_result_list;
goto __pyx_L0;
/* "osd.pyx":382
* check_osd_result(rv)
*
* def get_modules(self, subnet_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_module_desc *modules = NULL
* cdef size_t modules_len = 0
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.Hostmod.get_modules", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_result_list);
__Pyx_XDECREF(__pyx_v_mod_desc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":403
* return result_list
*
* def mod_describe(self, di_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_module_desc c_mod_desc
* rv = cosd.osd_hostmod_mod_describe(self._cself, di_addr, &c_mod_desc)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_17mod_describe(PyObject *__pyx_v_self, PyObject *__pyx_v_di_addr); /*proto*/
static char __pyx_doc_3osd_7Hostmod_16mod_describe[] = "Hostmod.mod_describe(self, di_addr)";
static PyObject *__pyx_pw_3osd_7Hostmod_17mod_describe(PyObject *__pyx_v_self, PyObject *__pyx_v_di_addr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mod_describe (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_16mod_describe(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), ((PyObject *)__pyx_v_di_addr));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_16mod_describe(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr) {
struct osd_module_desc __pyx_v_c_mod_desc;
osd_result __pyx_v_rv;
PyObject *__pyx_v_mod_desc = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
uint16_t __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("mod_describe", 0);
/* "osd.pyx":405
* def mod_describe(self, di_addr):
* cdef cosd.osd_module_desc c_mod_desc
* rv = cosd.osd_hostmod_mod_describe(self._cself, di_addr, &c_mod_desc) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_As_uint16_t(__pyx_v_di_addr); if (unlikely((__pyx_t_1 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error)
__pyx_v_rv = osd_hostmod_mod_describe(__pyx_v_self->_cself, __pyx_t_1, (&__pyx_v_c_mod_desc));
/* "osd.pyx":406
* cdef cosd.osd_module_desc c_mod_desc
* rv = cosd.osd_hostmod_mod_describe(self._cself, di_addr, &c_mod_desc)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* mod_desc = {}
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":408
* check_osd_result(rv)
*
* mod_desc = {} # <<<<<<<<<<<<<<
* mod_desc['addr'] = c_mod_desc.addr
* mod_desc['vendor'] = c_mod_desc.addr
*/
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_mod_desc = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":409
*
* mod_desc = {}
* mod_desc['addr'] = c_mod_desc.addr # <<<<<<<<<<<<<<
* mod_desc['vendor'] = c_mod_desc.addr
* mod_desc['type'] = c_mod_desc.addr
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_c_mod_desc.addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_addr, __pyx_t_3) < 0)) __PYX_ERR(0, 409, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":410
* mod_desc = {}
* mod_desc['addr'] = c_mod_desc.addr
* mod_desc['vendor'] = c_mod_desc.addr # <<<<<<<<<<<<<<
* mod_desc['type'] = c_mod_desc.addr
* mod_desc['version'] = c_mod_desc.addr
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_c_mod_desc.addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_vendor, __pyx_t_3) < 0)) __PYX_ERR(0, 410, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":411
* mod_desc['addr'] = c_mod_desc.addr
* mod_desc['vendor'] = c_mod_desc.addr
* mod_desc['type'] = c_mod_desc.addr # <<<<<<<<<<<<<<
* mod_desc['version'] = c_mod_desc.addr
*
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_c_mod_desc.addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_type, __pyx_t_3) < 0)) __PYX_ERR(0, 411, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":412
* mod_desc['vendor'] = c_mod_desc.addr
* mod_desc['type'] = c_mod_desc.addr
* mod_desc['version'] = c_mod_desc.addr # <<<<<<<<<<<<<<
*
* return mod_desc
*/
__pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_c_mod_desc.addr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely(PyDict_SetItem(__pyx_v_mod_desc, __pyx_n_u_version, __pyx_t_3) < 0)) __PYX_ERR(0, 412, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":414
* mod_desc['version'] = c_mod_desc.addr
*
* return mod_desc # <<<<<<<<<<<<<<
*
* def mod_set_event_dest(self, di_addr, flags=0):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_mod_desc);
__pyx_r = __pyx_v_mod_desc;
goto __pyx_L0;
/* "osd.pyx":403
* return result_list
*
* def mod_describe(self, di_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_module_desc c_mod_desc
* rv = cosd.osd_hostmod_mod_describe(self._cself, di_addr, &c_mod_desc)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.Hostmod.mod_describe", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_mod_desc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":416
* return mod_desc
*
* def mod_set_event_dest(self, di_addr, flags=0): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_mod_set_event_dest(self._cself, di_addr, flags)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_19mod_set_event_dest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_7Hostmod_18mod_set_event_dest[] = "Hostmod.mod_set_event_dest(self, di_addr, flags=0)";
static PyObject *__pyx_pw_3osd_7Hostmod_19mod_set_event_dest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_di_addr = 0;
PyObject *__pyx_v_flags = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mod_set_event_dest (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_di_addr,&__pyx_n_s_flags,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)__pyx_int_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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_di_addr)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mod_set_event_dest") < 0)) __PYX_ERR(0, 416, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_di_addr = values[0];
__pyx_v_flags = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mod_set_event_dest", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 416, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostmod.mod_set_event_dest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_7Hostmod_18mod_set_event_dest(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_di_addr, __pyx_v_flags);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_18mod_set_event_dest(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr, PyObject *__pyx_v_flags) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
uint16_t __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("mod_set_event_dest", 0);
/* "osd.pyx":417
*
* def mod_set_event_dest(self, di_addr, flags=0):
* rv = cosd.osd_hostmod_mod_set_event_dest(self._cself, di_addr, flags) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_As_uint16_t(__pyx_v_di_addr); if (unlikely((__pyx_t_1 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error)
__pyx_v_rv = osd_hostmod_mod_set_event_dest(__pyx_v_self->_cself, __pyx_t_1, __pyx_t_2);
/* "osd.pyx":418
* def mod_set_event_dest(self, di_addr, flags=0):
* rv = cosd.osd_hostmod_mod_set_event_dest(self._cself, di_addr, flags)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def mod_set_event_active(self, di_addr, enabled=True, flags=0):
*/
__pyx_t_3 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __pyx_f_3osd_check_osd_result(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 418, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":416
* return mod_desc
*
* def mod_set_event_dest(self, di_addr, flags=0): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_mod_set_event_dest(self._cself, di_addr, flags)
* check_osd_result(rv)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.Hostmod.mod_set_event_dest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":420
* check_osd_result(rv)
*
* def mod_set_event_active(self, di_addr, enabled=True, flags=0): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr,
* enabled, flags)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_21mod_set_event_active(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_7Hostmod_20mod_set_event_active[] = "Hostmod.mod_set_event_active(self, di_addr, enabled=True, flags=0)";
static PyObject *__pyx_pw_3osd_7Hostmod_21mod_set_event_active(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_di_addr = 0;
PyObject *__pyx_v_enabled = 0;
PyObject *__pyx_v_flags = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mod_set_event_active (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_di_addr,&__pyx_n_s_enabled,&__pyx_n_s_flags,0};
PyObject* values[3] = {0,0,0};
values[1] = ((PyObject *)Py_True);
values[2] = ((PyObject *)__pyx_int_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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_di_addr)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enabled);
if (value) { values[1] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mod_set_event_active") < 0)) __PYX_ERR(0, 420, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_di_addr = values[0];
__pyx_v_enabled = values[1];
__pyx_v_flags = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mod_set_event_active", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 420, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostmod.mod_set_event_active", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_7Hostmod_20mod_set_event_active(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_di_addr, __pyx_v_enabled, __pyx_v_flags);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_20mod_set_event_active(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr, PyObject *__pyx_v_enabled, PyObject *__pyx_v_flags) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
uint16_t __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("mod_set_event_active", 0);
/* "osd.pyx":421
*
* def mod_set_event_active(self, di_addr, enabled=True, flags=0):
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr, # <<<<<<<<<<<<<<
* enabled, flags)
* check_osd_result(rv)
*/
__pyx_t_1 = __Pyx_PyInt_As_uint16_t(__pyx_v_di_addr); if (unlikely((__pyx_t_1 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L1_error)
/* "osd.pyx":422
* def mod_set_event_active(self, di_addr, enabled=True, flags=0):
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr,
* enabled, flags) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_enabled); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error)
/* "osd.pyx":421
*
* def mod_set_event_active(self, di_addr, enabled=True, flags=0):
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr, # <<<<<<<<<<<<<<
* enabled, flags)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_hostmod_mod_set_event_active(__pyx_v_self->_cself, __pyx_t_1, __pyx_t_2, __pyx_t_3);
/* "osd.pyx":423
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr,
* enabled, flags)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def get_max_event_words(self, di_addr_target):
*/
__pyx_t_4 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __pyx_f_3osd_check_osd_result(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "osd.pyx":420
* check_osd_result(rv)
*
* def mod_set_event_active(self, di_addr, enabled=True, flags=0): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_mod_set_event_active(self._cself, di_addr,
* enabled, flags)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("osd.Hostmod.mod_set_event_active", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":425
* check_osd_result(rv)
*
* def get_max_event_words(self, di_addr_target): # <<<<<<<<<<<<<<
* return cosd.osd_hostmod_get_max_event_words(self._cself, di_addr_target)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_23get_max_event_words(PyObject *__pyx_v_self, PyObject *__pyx_v_di_addr_target); /*proto*/
static char __pyx_doc_3osd_7Hostmod_22get_max_event_words[] = "Hostmod.get_max_event_words(self, di_addr_target)";
static PyObject *__pyx_pw_3osd_7Hostmod_23get_max_event_words(PyObject *__pyx_v_self, PyObject *__pyx_v_di_addr_target) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_max_event_words (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_22get_max_event_words(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), ((PyObject *)__pyx_v_di_addr_target));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_22get_max_event_words(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_di_addr_target) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("get_max_event_words", 0);
/* "osd.pyx":426
*
* def get_max_event_words(self, di_addr_target):
* return cosd.osd_hostmod_get_max_event_words(self._cself, di_addr_target) # <<<<<<<<<<<<<<
*
* def event_send(self, Packet event_pkg):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_di_addr_target); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_unsigned_int(osd_hostmod_get_max_event_words(__pyx_v_self->_cself, __pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* "osd.pyx":425
* check_osd_result(rv)
*
* def get_max_event_words(self, di_addr_target): # <<<<<<<<<<<<<<
* return cosd.osd_hostmod_get_max_event_words(self._cself, di_addr_target)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("osd.Hostmod.get_max_event_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":428
* return cosd.osd_hostmod_get_max_event_words(self._cself, di_addr_target)
*
* def event_send(self, Packet event_pkg): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_event_send(self._cself, event_pkg._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_25event_send(PyObject *__pyx_v_self, PyObject *__pyx_v_event_pkg); /*proto*/
static char __pyx_doc_3osd_7Hostmod_24event_send[] = "Hostmod.event_send(self, Packet event_pkg)";
static PyObject *__pyx_pw_3osd_7Hostmod_25event_send(PyObject *__pyx_v_self, PyObject *__pyx_v_event_pkg) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("event_send (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_event_pkg), __pyx_ptype_3osd_Packet, 1, "event_pkg", 0))) __PYX_ERR(0, 428, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_7Hostmod_24event_send(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), ((struct __pyx_obj_3osd_Packet *)__pyx_v_event_pkg));
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_24event_send(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, struct __pyx_obj_3osd_Packet *__pyx_v_event_pkg) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("event_send", 0);
/* "osd.pyx":429
*
* def event_send(self, Packet event_pkg):
* rv = cosd.osd_hostmod_event_send(self._cself, event_pkg._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_hostmod_event_send(__pyx_v_self->_cself, __pyx_v_event_pkg->__pyx_base._cself);
/* "osd.pyx":430
* def event_send(self, Packet event_pkg):
* rv = cosd.osd_hostmod_event_send(self._cself, event_pkg._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def event_receive(self, flags=0):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":428
* return cosd.osd_hostmod_get_max_event_words(self._cself, di_addr_target)
*
* def event_send(self, Packet event_pkg): # <<<<<<<<<<<<<<
* rv = cosd.osd_hostmod_event_send(self._cself, event_pkg._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.Hostmod.event_send", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":432
* check_osd_result(rv)
*
* def event_receive(self, flags=0): # <<<<<<<<<<<<<<
* cdef cosd.osd_packet* c_event_pkg
* rv = cosd.osd_hostmod_event_receive(self._cself, &c_event_pkg, flags)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_27event_receive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_7Hostmod_26event_receive[] = "Hostmod.event_receive(self, flags=0)";
static PyObject *__pyx_pw_3osd_7Hostmod_27event_receive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_flags = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("event_receive (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flags,0};
PyObject* values[1] = {0};
values[0] = ((PyObject *)__pyx_int_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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "event_receive") < 0)) __PYX_ERR(0, 432, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_flags = values[0];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("event_receive", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 432, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostmod.event_receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_7Hostmod_26event_receive(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), __pyx_v_flags);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_26event_receive(struct __pyx_obj_3osd_Hostmod *__pyx_v_self, PyObject *__pyx_v_flags) {
struct osd_packet *__pyx_v_c_event_pkg;
osd_result __pyx_v_rv;
struct __pyx_obj_3osd_Packet *__pyx_v_py_event_pkg = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("event_receive", 0);
/* "osd.pyx":434
* def event_receive(self, flags=0):
* cdef cosd.osd_packet* c_event_pkg
* rv = cosd.osd_hostmod_event_receive(self._cself, &c_event_pkg, flags) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_flags); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error)
__pyx_v_rv = osd_hostmod_event_receive(__pyx_v_self->_cself, (&__pyx_v_c_event_pkg), __pyx_t_1);
/* "osd.pyx":435
* cdef cosd.osd_packet* c_event_pkg
* rv = cosd.osd_hostmod_event_receive(self._cself, &c_event_pkg, flags)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* py_event_pkg = Packet()
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 435, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":437
* check_osd_result(rv)
*
* py_event_pkg = Packet() # <<<<<<<<<<<<<<
* py_event_pkg._cself = c_event_pkg
*
*/
__pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_3osd_Packet)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_py_event_pkg = ((struct __pyx_obj_3osd_Packet *)__pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":438
*
* py_event_pkg = Packet()
* py_event_pkg._cself = c_event_pkg # <<<<<<<<<<<<<<
*
* return py_event_pkg
*/
__pyx_v_py_event_pkg->__pyx_base._cself = __pyx_v_c_event_pkg;
/* "osd.pyx":440
* py_event_pkg._cself = c_event_pkg
*
* return py_event_pkg # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_py_event_pkg));
__pyx_r = ((PyObject *)__pyx_v_py_event_pkg);
goto __pyx_L0;
/* "osd.pyx":432
* check_osd_result(rv)
*
* def event_receive(self, flags=0): # <<<<<<<<<<<<<<
* cdef cosd.osd_packet* c_event_pkg
* rv = cosd.osd_hostmod_event_receive(self._cself, &c_event_pkg, flags)
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.Hostmod.event_receive", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_py_event_pkg);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_7Hostmod_28__reduce_cython__[] = "Hostmod.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_7Hostmod_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_28__reduce_cython__(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostmod *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostmod.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7Hostmod_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_7Hostmod_30__setstate_cython__[] = "Hostmod.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_7Hostmod_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_7Hostmod_30__setstate_cython__(((struct __pyx_obj_3osd_Hostmod *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_7Hostmod_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostmod *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostmod.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":446
* cdef cosd.osd_gateway_glip_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address, device_subnet_addr, # <<<<<<<<<<<<<<
* glip_backend_name, glip_backend_options):
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_11GatewayGlip_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_11GatewayGlip_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_host_controller_address = 0;
PyObject *__pyx_v_device_subnet_addr = 0;
PyObject *__pyx_v_glip_backend_name = 0;
PyObject *__pyx_v_glip_backend_options = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_host_controller_address,&__pyx_n_s_device_subnet_addr,&__pyx_n_s_glip_backend_name,&__pyx_n_s_glip_backend_options,0};
PyObject* values[5] = {0,0,0,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 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host_controller_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); __PYX_ERR(0, 446, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_device_subnet_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); __PYX_ERR(0, 446, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_glip_backend_name)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); __PYX_ERR(0, 446, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_glip_backend_options)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); __PYX_ERR(0, 446, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 446, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
}
__pyx_v_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_host_controller_address = values[1];
__pyx_v_device_subnet_addr = values[2];
__pyx_v_glip_backend_name = values[3];
__pyx_v_glip_backend_options = values[4];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 446, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.GatewayGlip.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 446, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_11GatewayGlip___cinit__(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self), __pyx_v_log, __pyx_v_host_controller_address, __pyx_v_device_subnet_addr, __pyx_v_glip_backend_name, __pyx_v_glip_backend_options);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_11GatewayGlip___cinit__(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_device_subnet_addr, PyObject *__pyx_v_glip_backend_name, PyObject *__pyx_v_glip_backend_options) {
PyObject *__pyx_v_b_host_controller_address = NULL;
char *__pyx_v_c_host_controller_address;
PyObject *__pyx_v_b_glip_backend_name = NULL;
char *__pyx_v_c_glip_backend_name;
PyObject *__pyx_v_c_glip_backend_options_len = NULL;
struct glip_option *__pyx_v_c_glip_backend_options;
PyObject *__pyx_v_index = NULL;
PyObject *__pyx_v_name = NULL;
PyObject *__pyx_v_value = NULL;
PyObject *__pyx_v_b_name = NULL;
PyObject *__pyx_v_b_value = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char *__pyx_t_4;
Py_ssize_t __pyx_t_5;
size_t __pyx_t_6;
Py_ssize_t __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
Py_ssize_t __pyx_t_11;
uint16_t __pyx_t_12;
int __pyx_t_13;
char const *__pyx_t_14;
PyObject *__pyx_t_15 = NULL;
PyObject *__pyx_t_16 = NULL;
PyObject *__pyx_t_17 = NULL;
PyObject *__pyx_t_18 = NULL;
PyObject *__pyx_t_19 = NULL;
PyObject *__pyx_t_20 = NULL;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":449
* glip_backend_name, glip_backend_options):
*
* b_host_controller_address = host_controller_address.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_host_controller_address = b_host_controller_address
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host_controller_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_b_host_controller_address = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":450
*
* b_host_controller_address = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = b_host_controller_address # <<<<<<<<<<<<<<
*
* b_glip_backend_name = glip_backend_name.encode('UTF-8')
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_b_host_controller_address); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L1_error)
__pyx_v_c_host_controller_address = __pyx_t_4;
/* "osd.pyx":452
* cdef char* c_host_controller_address = b_host_controller_address
*
* b_glip_backend_name = glip_backend_name.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_glip_backend_name = b_glip_backend_name
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_glip_backend_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_b_glip_backend_name = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":453
*
* b_glip_backend_name = glip_backend_name.encode('UTF-8')
* cdef char* c_glip_backend_name = b_glip_backend_name # <<<<<<<<<<<<<<
*
* c_glip_backend_options_len = len(glip_backend_options)
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_b_glip_backend_name); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 453, __pyx_L1_error)
__pyx_v_c_glip_backend_name = __pyx_t_4;
/* "osd.pyx":455
* cdef char* c_glip_backend_name = b_glip_backend_name
*
* c_glip_backend_options_len = len(glip_backend_options) # <<<<<<<<<<<<<<
* cdef cosd.glip_option* c_glip_backend_options = \
* <cosd.glip_option *>PyMem_Malloc(sizeof(cosd.glip_option) * \
*/
__pyx_t_5 = PyObject_Length(__pyx_v_glip_backend_options); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 455, __pyx_L1_error)
__pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_c_glip_backend_options_len = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":457
* c_glip_backend_options_len = len(glip_backend_options)
* cdef cosd.glip_option* c_glip_backend_options = \
* <cosd.glip_option *>PyMem_Malloc(sizeof(cosd.glip_option) * \ # <<<<<<<<<<<<<<
* c_glip_backend_options_len)
*
*/
__pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(struct glip_option))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
/* "osd.pyx":458
* cdef cosd.glip_option* c_glip_backend_options = \
* <cosd.glip_option *>PyMem_Malloc(sizeof(cosd.glip_option) * \
* c_glip_backend_options_len) # <<<<<<<<<<<<<<
*
* try:
*/
__pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_c_glip_backend_options_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":457
* c_glip_backend_options_len = len(glip_backend_options)
* cdef cosd.glip_option* c_glip_backend_options = \
* <cosd.glip_option *>PyMem_Malloc(sizeof(cosd.glip_option) * \ # <<<<<<<<<<<<<<
* c_glip_backend_options_len)
*
*/
__pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_c_glip_backend_options = ((struct glip_option *)PyMem_Malloc(__pyx_t_6));
/* "osd.pyx":460
* c_glip_backend_options_len)
*
* try: # <<<<<<<<<<<<<<
* index = 0
* for name, value in glip_backend_options.items():
*/
/*try:*/ {
/* "osd.pyx":461
*
* try:
* index = 0 # <<<<<<<<<<<<<<
* for name, value in glip_backend_options.items():
* b_name = name.encode('UTF-8')
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_v_index = __pyx_int_0;
/* "osd.pyx":462
* try:
* index = 0
* for name, value in glip_backend_options.items(): # <<<<<<<<<<<<<<
* b_name = name.encode('UTF-8')
* b_value = value.encode('UTF-8')
*/
__pyx_t_5 = 0;
if (unlikely(__pyx_v_glip_backend_options == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
__PYX_ERR(0, 462, __pyx_L4_error)
}
__pyx_t_1 = __Pyx_dict_iterator(__pyx_v_glip_backend_options, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__pyx_t_2 = __pyx_t_1;
__pyx_t_1 = 0;
while (1) {
__pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_7, &__pyx_t_5, &__pyx_t_1, &__pyx_t_3, NULL, __pyx_t_8);
if (unlikely(__pyx_t_9 == 0)) break;
if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 462, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1);
__pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":463
* index = 0
* for name, value in glip_backend_options.items():
* b_name = name.encode('UTF-8') # <<<<<<<<<<<<<<
* b_value = value.encode('UTF-8')
* c_glip_backend_options[index].name = b_name
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_10 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_10)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
}
}
__pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_b_name, __pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":464
* for name, value in glip_backend_options.items():
* b_name = name.encode('UTF-8')
* b_value = value.encode('UTF-8') # <<<<<<<<<<<<<<
* c_glip_backend_options[index].name = b_name
* c_glip_backend_options[index].value = b_value
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_10 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_10)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
}
}
__pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF_SET(__pyx_v_b_value, __pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":465
* b_name = name.encode('UTF-8')
* b_value = value.encode('UTF-8')
* c_glip_backend_options[index].name = b_name # <<<<<<<<<<<<<<
* c_glip_backend_options[index].value = b_value
* index += 1
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_b_name); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L4_error)
(__pyx_v_c_glip_backend_options[__pyx_t_11]).name = __pyx_t_4;
/* "osd.pyx":466
* b_value = value.encode('UTF-8')
* c_glip_backend_options[index].name = b_name
* c_glip_backend_options[index].value = b_value # <<<<<<<<<<<<<<
* index += 1
*
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_b_value); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L4_error)
__pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L4_error)
(__pyx_v_c_glip_backend_options[__pyx_t_11]).value = __pyx_t_4;
/* "osd.pyx":467
* c_glip_backend_options[index].name = b_name
* c_glip_backend_options[index].value = b_value
* index += 1 # <<<<<<<<<<<<<<
*
* cosd.osd_gateway_glip_new(&self._cself, log._cself,
*/
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
__pyx_t_3 = 0;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":471
* cosd.osd_gateway_glip_new(&self._cself, log._cself,
* c_host_controller_address,
* device_subnet_addr, # <<<<<<<<<<<<<<
* c_glip_backend_name,
* c_glip_backend_options,
*/
__pyx_t_12 = __Pyx_PyInt_As_uint16_t(__pyx_v_device_subnet_addr); if (unlikely((__pyx_t_12 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L4_error)
/* "osd.pyx":474
* c_glip_backend_name,
* c_glip_backend_options,
* c_glip_backend_options_len) # <<<<<<<<<<<<<<
*
* if self._cself is NULL:
*/
__pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_c_glip_backend_options_len); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L4_error)
/* "osd.pyx":469
* index += 1
*
* cosd.osd_gateway_glip_new(&self._cself, log._cself, # <<<<<<<<<<<<<<
* c_host_controller_address,
* device_subnet_addr,
*/
(void)(osd_gateway_glip_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_v_c_host_controller_address, __pyx_t_12, __pyx_v_c_glip_backend_name, __pyx_v_c_glip_backend_options, __pyx_t_6));
/* "osd.pyx":476
* c_glip_backend_options_len)
*
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
* finally:
*/
__pyx_t_13 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_13)) {
/* "osd.pyx":477
*
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
* finally:
* PyMem_Free(c_glip_backend_options)
*/
PyErr_NoMemory(); __PYX_ERR(0, 477, __pyx_L4_error)
/* "osd.pyx":476
* c_glip_backend_options_len)
*
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
* finally:
*/
}
}
/* "osd.pyx":479
* raise MemoryError()
* finally:
* PyMem_Free(c_glip_backend_options) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
/*finally:*/ {
/*normal exit:*/{
PyMem_Free(__pyx_v_c_glip_backend_options);
goto __pyx_L5;
}
__pyx_L4_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_18);
__Pyx_XGOTREF(__pyx_t_19);
__Pyx_XGOTREF(__pyx_t_20);
__pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
{
PyMem_Free(__pyx_v_c_glip_backend_options);
}
if (PY_MAJOR_VERSION >= 3) {
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_XGIVEREF(__pyx_t_20);
__Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
}
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
__pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
__pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_14;
goto __pyx_L1_error;
}
__pyx_L5:;
}
/* "osd.pyx":446
* cdef cosd.osd_gateway_glip_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address, device_subnet_addr, # <<<<<<<<<<<<<<
* glip_backend_name, glip_backend_options):
*
*/
/* function exit code */
__pyx_r = 0;
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_10);
__Pyx_AddTraceback("osd.GatewayGlip.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_host_controller_address);
__Pyx_XDECREF(__pyx_v_b_glip_backend_name);
__Pyx_XDECREF(__pyx_v_c_glip_backend_options_len);
__Pyx_XDECREF(__pyx_v_index);
__Pyx_XDECREF(__pyx_v_name);
__Pyx_XDECREF(__pyx_v_value);
__Pyx_XDECREF(__pyx_v_b_name);
__Pyx_XDECREF(__pyx_v_b_value);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":481
* PyMem_Free(c_glip_backend_options)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_11GatewayGlip_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_11GatewayGlip_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_11GatewayGlip_2__dealloc__(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_11GatewayGlip_2__dealloc__(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":482
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":483
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* if self.is_connected():
*/
goto __pyx_L0;
/* "osd.pyx":482
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":485
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_connected); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 485, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
/* "osd.pyx":486
*
* if self.is_connected():
* self.disconnect() # <<<<<<<<<<<<<<
*
* cosd.osd_gateway_glip_free(&self._cself)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_disconnect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":485
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
}
/* "osd.pyx":488
* self.disconnect()
*
* cosd.osd_gateway_glip_free(&self._cself) # <<<<<<<<<<<<<<
*
* def connect(self):
*/
osd_gateway_glip_free((&__pyx_v_self->_cself));
/* "osd.pyx":481
* PyMem_Free(c_glip_backend_options)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("osd.GatewayGlip.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":490
* cosd.osd_gateway_glip_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_connect(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_4connect[] = "GatewayGlip.connect(self)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_4connect(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_4connect(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("connect", 0);
/* "osd.pyx":491
*
* def connect(self):
* return cosd.osd_gateway_glip_connect(self._cself) # <<<<<<<<<<<<<<
*
* def disconnect(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_osd_result(osd_gateway_glip_connect(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":490
* cosd.osd_gateway_glip_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_connect(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.GatewayGlip.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":493
* return cosd.osd_gateway_glip_connect(self._cself)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_disconnect(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_6disconnect[] = "GatewayGlip.disconnect(self)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_6disconnect(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_6disconnect(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("disconnect", 0);
/* "osd.pyx":494
*
* def disconnect(self):
* return cosd.osd_gateway_glip_disconnect(self._cself) # <<<<<<<<<<<<<<
*
* def is_connected(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_osd_result(osd_gateway_glip_disconnect(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":493
* return cosd.osd_gateway_glip_connect(self._cself)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_disconnect(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.GatewayGlip.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":496
* return cosd.osd_gateway_glip_disconnect(self._cself)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_is_connected(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_8is_connected[] = "GatewayGlip.is_connected(self)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_8is_connected(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_8is_connected(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_connected", 0);
/* "osd.pyx":497
*
* def is_connected(self):
* return cosd.osd_gateway_glip_is_connected(self._cself) # <<<<<<<<<<<<<<
*
* def get_transfer_stats(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_gateway_glip_is_connected(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":496
* return cosd.osd_gateway_glip_disconnect(self._cself)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_gateway_glip_is_connected(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.GatewayGlip.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":499
* return cosd.osd_gateway_glip_is_connected(self._cself)
*
* def get_transfer_stats(self): # <<<<<<<<<<<<<<
* cdef cosd.osd_gateway_transfer_stats *stats
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_11get_transfer_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_10get_transfer_stats[] = "GatewayGlip.get_transfer_stats(self)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_11get_transfer_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_transfer_stats (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_10get_transfer_stats(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_10get_transfer_stats(struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
struct osd_gateway_transfer_stats *__pyx_v_stats;
double __pyx_v_connect_time_float;
PyObject *__pyx_v_cur_time = NULL;
PyObject *__pyx_v_time_elapsed = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("get_transfer_stats", 0);
/* "osd.pyx":502
* cdef cosd.osd_gateway_transfer_stats *stats
*
* stats = cosd.osd_gateway_glip_get_transfer_stats(self._cself) # <<<<<<<<<<<<<<
*
* connect_time_float = stats.connect_time.tv_sec + stats.connect_time.tv_nsec * 1e-9
*/
__pyx_v_stats = osd_gateway_glip_get_transfer_stats(__pyx_v_self->_cself);
/* "osd.pyx":504
* stats = cosd.osd_gateway_glip_get_transfer_stats(self._cself)
*
* connect_time_float = stats.connect_time.tv_sec + stats.connect_time.tv_nsec * 1e-9 # <<<<<<<<<<<<<<
* cur_time = time.clock_gettime(time.CLOCK_MONOTONIC)
* time_elapsed = cur_time - connect_time_float
*/
__pyx_v_connect_time_float = (__pyx_v_stats->connect_time.tv_sec + (__pyx_v_stats->connect_time.tv_nsec * 1e-9));
/* "osd.pyx":505
*
* connect_time_float = stats.connect_time.tv_sec + stats.connect_time.tv_nsec * 1e-9
* cur_time = time.clock_gettime(time.CLOCK_MONOTONIC) # <<<<<<<<<<<<<<
* time_elapsed = cur_time - connect_time_float
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clock_gettime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_CLOCK_MONOTONIC); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_cur_time = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":506
* connect_time_float = stats.connect_time.tv_sec + stats.connect_time.tv_nsec * 1e-9
* cur_time = time.clock_gettime(time.CLOCK_MONOTONIC)
* time_elapsed = cur_time - connect_time_float # <<<<<<<<<<<<<<
*
* return { 'bytes_from_device': stats.bytes_from_device,
*/
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_connect_time_float); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyNumber_Subtract(__pyx_v_cur_time, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_time_elapsed = __pyx_t_3;
__pyx_t_3 = 0;
/* "osd.pyx":508
* time_elapsed = cur_time - connect_time_float
*
* return { 'bytes_from_device': stats.bytes_from_device, # <<<<<<<<<<<<<<
* 'bytes_to_device': stats.bytes_to_device,
* 'connected_secs': time_elapsed }
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_stats->bytes_from_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_bytes_from_device, __pyx_t_1) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":509
*
* return { 'bytes_from_device': stats.bytes_from_device,
* 'bytes_to_device': stats.bytes_to_device, # <<<<<<<<<<<<<<
* 'connected_secs': time_elapsed }
*
*/
__pyx_t_1 = __Pyx_PyInt_From_uint64_t(__pyx_v_stats->bytes_to_device); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_bytes_to_device, __pyx_t_1) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":510
* return { 'bytes_from_device': stats.bytes_from_device,
* 'bytes_to_device': stats.bytes_to_device,
* 'connected_secs': time_elapsed } # <<<<<<<<<<<<<<
*
*
*/
if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_connected_secs, __pyx_v_time_elapsed) < 0) __PYX_ERR(0, 508, __pyx_L1_error)
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* "osd.pyx":499
* return cosd.osd_gateway_glip_is_connected(self._cself)
*
* def get_transfer_stats(self): # <<<<<<<<<<<<<<
* cdef cosd.osd_gateway_transfer_stats *stats
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.GatewayGlip.get_transfer_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_cur_time);
__Pyx_XDECREF(__pyx_v_time_elapsed);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_12__reduce_cython__[] = "GatewayGlip.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_12__reduce_cython__(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.GatewayGlip.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_11GatewayGlip_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_11GatewayGlip_14__setstate_cython__[] = "GatewayGlip.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_11GatewayGlip_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_11GatewayGlip_14__setstate_cython__(((struct __pyx_obj_3osd_GatewayGlip *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_11GatewayGlip_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_GatewayGlip *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.GatewayGlip.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":516
* cdef cosd.osd_hostctrl_ctx* _cself
*
* def __cinit__(self, Log log, router_address): # <<<<<<<<<<<<<<
* py_byte_string = router_address.encode('UTF-8')
* cdef char* c_router_address = py_byte_string
*/
/* Python wrapper */
static int __pyx_pw_3osd_8Hostctrl_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_8Hostctrl_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_router_address = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_router_address,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_router_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 516, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 516, __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_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_router_address = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 516, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Hostctrl.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 516, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_8Hostctrl___cinit__(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self), __pyx_v_log, __pyx_v_router_address);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_8Hostctrl___cinit__(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_router_address) {
PyObject *__pyx_v_py_byte_string = NULL;
char *__pyx_v_c_router_address;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char *__pyx_t_4;
int __pyx_t_5;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":517
*
* def __cinit__(self, Log log, router_address):
* py_byte_string = router_address.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_router_address = py_byte_string
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address)
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_router_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_py_byte_string = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":518
* def __cinit__(self, Log log, router_address):
* py_byte_string = router_address.encode('UTF-8')
* cdef char* c_router_address = py_byte_string # <<<<<<<<<<<<<<
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address)
* if self._cself is NULL:
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
__pyx_v_c_router_address = __pyx_t_4;
/* "osd.pyx":519
* py_byte_string = router_address.encode('UTF-8')
* cdef char* c_router_address = py_byte_string
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address) # <<<<<<<<<<<<<<
* if self._cself is NULL:
* raise MemoryError()
*/
(void)(osd_hostctrl_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_v_c_router_address));
/* "osd.pyx":520
* cdef char* c_router_address = py_byte_string
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_5 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_5)) {
/* "osd.pyx":521
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address)
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 521, __pyx_L1_error)
/* "osd.pyx":520
* cdef char* c_router_address = py_byte_string
* cosd.osd_hostctrl_new(&self._cself, log._cself, c_router_address)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":516
* cdef cosd.osd_hostctrl_ctx* _cself
*
* def __cinit__(self, Log log, router_address): # <<<<<<<<<<<<<<
* py_byte_string = router_address.encode('UTF-8')
* cdef char* c_router_address = py_byte_string
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.Hostctrl.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_byte_string);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":523
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_8Hostctrl_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_8Hostctrl_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_8Hostctrl_2__dealloc__(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_8Hostctrl_2__dealloc__(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":524
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":525
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* if self.is_running():
*/
goto __pyx_L0;
/* "osd.pyx":524
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":527
* return
*
* if self.is_running(): # <<<<<<<<<<<<<<
* self.stop()
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_running); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 527, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
/* "osd.pyx":528
*
* if self.is_running():
* self.stop() # <<<<<<<<<<<<<<
*
* cosd.osd_hostctrl_free(&self._cself)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":527
* return
*
* if self.is_running(): # <<<<<<<<<<<<<<
* self.stop()
*
*/
}
/* "osd.pyx":530
* self.stop()
*
* cosd.osd_hostctrl_free(&self._cself) # <<<<<<<<<<<<<<
*
* def start(self):
*/
osd_hostctrl_free((&__pyx_v_self->_cself));
/* "osd.pyx":523
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("osd.Hostctrl.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":532
* cosd.osd_hostctrl_free(&self._cself)
*
* def start(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_start(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_8Hostctrl_5start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_8Hostctrl_4start[] = "Hostctrl.start(self)";
static PyObject *__pyx_pw_3osd_8Hostctrl_5start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("start (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_8Hostctrl_4start(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8Hostctrl_4start(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("start", 0);
/* "osd.pyx":533
*
* def start(self):
* return cosd.osd_hostctrl_start(self._cself) # <<<<<<<<<<<<<<
*
* def stop(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_osd_result(osd_hostctrl_start(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":532
* cosd.osd_hostctrl_free(&self._cself)
*
* def start(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_start(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostctrl.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":535
* return cosd.osd_hostctrl_start(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_stop(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_8Hostctrl_7stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_8Hostctrl_6stop[] = "Hostctrl.stop(self)";
static PyObject *__pyx_pw_3osd_8Hostctrl_7stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("stop (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_8Hostctrl_6stop(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8Hostctrl_6stop(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("stop", 0);
/* "osd.pyx":536
*
* def stop(self):
* return cosd.osd_hostctrl_stop(self._cself) # <<<<<<<<<<<<<<
*
* def is_running(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_osd_result(osd_hostctrl_stop(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":535
* return cosd.osd_hostctrl_start(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_stop(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostctrl.stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":538
* return cosd.osd_hostctrl_stop(self._cself)
*
* def is_running(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_is_running(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_8Hostctrl_9is_running(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_8Hostctrl_8is_running[] = "Hostctrl.is_running(self)";
static PyObject *__pyx_pw_3osd_8Hostctrl_9is_running(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_running (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_8Hostctrl_8is_running(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8Hostctrl_8is_running(struct __pyx_obj_3osd_Hostctrl *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_running", 0);
/* "osd.pyx":539
*
* def is_running(self):
* return cosd.osd_hostctrl_is_running(self._cself) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_hostctrl_is_running(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":538
* return cosd.osd_hostctrl_stop(self._cself)
*
* def is_running(self): # <<<<<<<<<<<<<<
* return cosd.osd_hostctrl_is_running(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostctrl.is_running", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_8Hostctrl_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_8Hostctrl_10__reduce_cython__[] = "Hostctrl.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_8Hostctrl_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_8Hostctrl_10__reduce_cython__(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8Hostctrl_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostctrl *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostctrl.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_8Hostctrl_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_8Hostctrl_12__setstate_cython__[] = "Hostctrl.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_8Hostctrl_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_8Hostctrl_12__setstate_cython__(((struct __pyx_obj_3osd_Hostctrl *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8Hostctrl_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_Hostctrl *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Hostctrl.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":544
* cdef class Module:
* @staticmethod
* def get_type_short_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Module_1get_type_short_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_6Module_get_type_short_name[] = "Module.get_type_short_name(vendor_id, type_id)";
static PyMethodDef __pyx_mdef_3osd_6Module_1get_type_short_name = {"get_type_short_name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_6Module_1get_type_short_name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_6Module_get_type_short_name};
static PyObject *__pyx_pw_3osd_6Module_1get_type_short_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vendor_id = 0;
PyObject *__pyx_v_type_id = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_type_short_name (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vendor_id,&__pyx_n_s_type_id,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vendor_id)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type_id)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("get_type_short_name", 1, 2, 2, 1); __PYX_ERR(0, 544, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_type_short_name") < 0)) __PYX_ERR(0, 544, __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_vendor_id = values[0];
__pyx_v_type_id = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("get_type_short_name", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 544, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Module.get_type_short_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_6Module_get_type_short_name(__pyx_v_vendor_id, __pyx_v_type_id);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Module_get_type_short_name(PyObject *__pyx_v_vendor_id, PyObject *__pyx_v_type_id) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("get_type_short_name", 0);
/* "osd.pyx":545
* @staticmethod
* def get_type_short_name(vendor_id, type_id):
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id)) # <<<<<<<<<<<<<<
*
* @staticmethod
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_vendor_id); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_As_unsigned_int(__pyx_v_type_id); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyBytes_FromString(osd_module_get_type_short_name(__pyx_t_1, __pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "osd.pyx":544
* cdef class Module:
* @staticmethod
* def get_type_short_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.Module.get_type_short_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":548
*
* @staticmethod
* def get_type_long_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id))
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Module_3get_type_long_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_6Module_2get_type_long_name[] = "Module.get_type_long_name(vendor_id, type_id)";
static PyMethodDef __pyx_mdef_3osd_6Module_3get_type_long_name = {"get_type_long_name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_6Module_3get_type_long_name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_6Module_2get_type_long_name};
static PyObject *__pyx_pw_3osd_6Module_3get_type_long_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vendor_id = 0;
PyObject *__pyx_v_type_id = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_type_long_name (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vendor_id,&__pyx_n_s_type_id,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vendor_id)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type_id)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("get_type_long_name", 1, 2, 2, 1); __PYX_ERR(0, 548, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_type_long_name") < 0)) __PYX_ERR(0, 548, __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_vendor_id = values[0];
__pyx_v_type_id = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("get_type_long_name", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 548, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.Module.get_type_long_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_6Module_2get_type_long_name(__pyx_v_vendor_id, __pyx_v_type_id);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Module_2get_type_long_name(PyObject *__pyx_v_vendor_id, PyObject *__pyx_v_type_id) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
unsigned int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("get_type_long_name", 0);
/* "osd.pyx":549
* @staticmethod
* def get_type_long_name(vendor_id, type_id):
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id)) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_vendor_id); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_As_unsigned_int(__pyx_v_type_id); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyBytes_FromString(osd_module_get_type_long_name(__pyx_t_1, __pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
/* "osd.pyx":548
*
* @staticmethod
* def get_type_long_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id))
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.Module.get_type_long_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* cdef tuple state
* cdef object _dict
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Module_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_6Module_4__reduce_cython__[] = "Module.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_6Module_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_6Module_4__reduce_cython__(((struct __pyx_obj_3osd_Module *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Module_4__reduce_cython__(struct __pyx_obj_3osd_Module *__pyx_v_self) {
PyObject *__pyx_v_state = 0;
PyObject *__pyx_v__dict = 0;
int __pyx_v_use_setstate;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":5
* cdef object _dict
* cdef bint use_setstate
* state = () # <<<<<<<<<<<<<<
* _dict = getattr(self, '__dict__', None)
* if _dict is not None:
*/
__Pyx_INCREF(__pyx_empty_tuple);
__pyx_v_state = __pyx_empty_tuple;
/* "(tree fragment)":6
* cdef bint use_setstate
* state = ()
* _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
* if _dict is not None:
* state += (_dict,)
*/
__pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v__dict = __pyx_t_1;
__pyx_t_1 = 0;
/* "(tree fragment)":7
* state = ()
* _dict = getattr(self, '__dict__', None)
* if _dict is not None: # <<<<<<<<<<<<<<
* state += (_dict,)
* use_setstate = True
*/
__pyx_t_2 = (__pyx_v__dict != Py_None);
__pyx_t_3 = (__pyx_t_2 != 0);
if (__pyx_t_3) {
/* "(tree fragment)":8
* _dict = getattr(self, '__dict__', None)
* if _dict is not None:
* state += (_dict,) # <<<<<<<<<<<<<<
* use_setstate = True
* else:
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v__dict);
__Pyx_GIVEREF(__pyx_v__dict);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
__pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
/* "(tree fragment)":9
* if _dict is not None:
* state += (_dict,)
* use_setstate = True # <<<<<<<<<<<<<<
* else:
* use_setstate = False
*/
__pyx_v_use_setstate = 1;
/* "(tree fragment)":7
* state = ()
* _dict = getattr(self, '__dict__', None)
* if _dict is not None: # <<<<<<<<<<<<<<
* state += (_dict,)
* use_setstate = True
*/
goto __pyx_L3;
}
/* "(tree fragment)":11
* use_setstate = True
* else:
* use_setstate = False # <<<<<<<<<<<<<<
* if use_setstate:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, None), state
*/
/*else*/ {
__pyx_v_use_setstate = 0;
}
__pyx_L3:;
/* "(tree fragment)":12
* else:
* use_setstate = False
* if use_setstate: # <<<<<<<<<<<<<<
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, None), state
* else:
*/
__pyx_t_3 = (__pyx_v_use_setstate != 0);
if (__pyx_t_3) {
/* "(tree fragment)":13
* use_setstate = False
* if use_setstate:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, None), state # <<<<<<<<<<<<<<
* else:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, state)
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Module); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
__Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
__Pyx_INCREF(__pyx_int_222419149);
__Pyx_GIVEREF(__pyx_int_222419149);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
__Pyx_INCREF(__pyx_v_state);
__Pyx_GIVEREF(__pyx_v_state);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
__pyx_t_4 = 0;
__pyx_t_1 = 0;
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L0;
/* "(tree fragment)":12
* else:
* use_setstate = False
* if use_setstate: # <<<<<<<<<<<<<<
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, None), state
* else:
*/
}
/* "(tree fragment)":15
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, None), state
* else:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, state) # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* __pyx_unpickle_Module__set_state(self, __pyx_state)
*/
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Module); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
__Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
__Pyx_INCREF(__pyx_int_222419149);
__Pyx_GIVEREF(__pyx_int_222419149);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
__Pyx_INCREF(__pyx_v_state);
__Pyx_GIVEREF(__pyx_v_state);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
__pyx_t_5 = 0;
__pyx_t_1 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* cdef tuple state
* cdef object _dict
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("osd.Module.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_state);
__Pyx_XDECREF(__pyx_v__dict);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":16
* else:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, state)
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* __pyx_unpickle_Module__set_state(self, __pyx_state)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_6Module_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_6Module_6__setstate_cython__[] = "Module.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_6Module_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_6Module_6__setstate_cython__(((struct __pyx_obj_3osd_Module *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6Module_6__setstate_cython__(struct __pyx_obj_3osd_Module *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":17
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, state)
* def __setstate_cython__(self, __pyx_state):
* __pyx_unpickle_Module__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
*/
if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
__pyx_t_1 = __pyx_f_3osd___pyx_unpickle_Module__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "(tree fragment)":16
* else:
* return __pyx_unpickle_Module, (type(self), 0xd41d8cd, state)
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* __pyx_unpickle_Module__set_state(self, __pyx_state)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.Module.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":555
* cdef cosd.osd_mem_desc _cself
*
* def __cinit__(self): # <<<<<<<<<<<<<<
* self._cself.num_regions = 0
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_16MemoryDescriptor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_16MemoryDescriptor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor___cinit__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_16MemoryDescriptor___cinit__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":556
*
* def __cinit__(self):
* self._cself.num_regions = 0 # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_v_self->_cself.num_regions = 0;
/* "osd.pyx":555
* cdef cosd.osd_mem_desc _cself
*
* def __cinit__(self): # <<<<<<<<<<<<<<
* self._cself.num_regions = 0
*
*/
/* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":559
*
* @property
* def regions(self): # <<<<<<<<<<<<<<
* r = []
* for i in range(self._cself.num_regions):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7regions_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7regions_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_7regions___get__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7regions___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_v_r = NULL;
uint8_t __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
uint8_t __pyx_t_2;
uint8_t __pyx_t_3;
uint8_t __pyx_t_4;
int __pyx_t_5;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":560
* @property
* def regions(self):
* r = [] # <<<<<<<<<<<<<<
* for i in range(self._cself.num_regions):
* r.append(self._cself.regions[i])
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_r = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "osd.pyx":561
* def regions(self):
* r = []
* for i in range(self._cself.num_regions): # <<<<<<<<<<<<<<
* r.append(self._cself.regions[i])
* return r
*/
__pyx_t_2 = __pyx_v_self->_cself.num_regions;
__pyx_t_3 = __pyx_t_2;
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
/* "osd.pyx":562
* r = []
* for i in range(self._cself.num_regions):
* r.append(self._cself.regions[i]) # <<<<<<<<<<<<<<
* return r
*
*/
__pyx_t_1 = __pyx_convert__to_py_struct__osd_mem_desc_region((__pyx_v_self->_cself.regions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_PyList_Append(__pyx_v_r, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
/* "osd.pyx":563
* for i in range(self._cself.num_regions):
* r.append(self._cself.regions[i])
* return r # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_r);
__pyx_r = __pyx_v_r;
goto __pyx_L0;
/* "osd.pyx":559
*
* @property
* def regions(self): # <<<<<<<<<<<<<<
* r = []
* for i in range(self._cself.num_regions):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.regions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_r);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":566
*
* @property
* def addr_width_bit(self): # <<<<<<<<<<<<<<
* return self._cself.addr_width_bit
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_14addr_width_bit_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_14addr_width_bit_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_14addr_width_bit___get__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_14addr_width_bit___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":567
* @property
* def addr_width_bit(self):
* return self._cself.addr_width_bit # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_self->_cself.addr_width_bit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":566
*
* @property
* def addr_width_bit(self): # <<<<<<<<<<<<<<
* return self._cself.addr_width_bit
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.addr_width_bit.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":570
*
* @property
* def data_width_bit(self): # <<<<<<<<<<<<<<
* return self._cself.data_width_bit
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_14data_width_bit_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_14data_width_bit_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_14data_width_bit___get__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_14data_width_bit___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":571
* @property
* def data_width_bit(self):
* return self._cself.data_width_bit # <<<<<<<<<<<<<<
*
* @property
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_self->_cself.data_width_bit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":570
*
* @property
* def data_width_bit(self): # <<<<<<<<<<<<<<
* return self._cself.data_width_bit
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.data_width_bit.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":574
*
* @property
* def di_addr(self): # <<<<<<<<<<<<<<
* return self._cself.di_addr
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7di_addr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7di_addr_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_7di_addr___get__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7di_addr___get__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":575
* @property
* def di_addr(self):
* return self._cself.di_addr # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->_cself.di_addr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":574
*
* @property
* def di_addr(self): # <<<<<<<<<<<<<<
* return self._cself.di_addr
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.di_addr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":577
* return self._cself.di_addr
*
* def __str__(self): # <<<<<<<<<<<<<<
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_3__str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_2__str__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":578
*
* def __str__(self):
* def sizeof_fmt(num, suffix='B'): # <<<<<<<<<<<<<<
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0:
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7__str___1sizeof_fmt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_3osd_16MemoryDescriptor_7__str___1sizeof_fmt = {"sizeof_fmt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_16MemoryDescriptor_7__str___1sizeof_fmt, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7__str___1sizeof_fmt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_num = 0;
PyObject *__pyx_v_suffix = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sizeof_fmt (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num,&__pyx_n_s_suffix,0};
PyObject* values[2] = {0,0};
values[1] = ((PyObject *)((PyObject*)__pyx_n_u_B));
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_suffix);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sizeof_fmt") < 0)) __PYX_ERR(0, 578, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_num = values[0];
__pyx_v_suffix = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sizeof_fmt", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 578, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.MemoryDescriptor.__str__.sizeof_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_7__str___sizeof_fmt(__pyx_self, __pyx_v_num, __pyx_v_suffix);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_7__str___sizeof_fmt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num, PyObject *__pyx_v_suffix) {
PyObject *__pyx_v_unit = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
Py_ssize_t __pyx_t_6;
Py_UCS4 __pyx_t_7;
__Pyx_RefNannySetupContext("sizeof_fmt", 0);
__Pyx_INCREF(__pyx_v_num);
/* "osd.pyx":579
* def __str__(self):
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: # <<<<<<<<<<<<<<
* if abs(num) < 1024.0:
* return "%3.1f %s%s" % (num, unit, suffix)
*/
__pyx_t_1 = __pyx_tuple__16; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= 8) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 579, __pyx_L1_error)
#else
__pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
#endif
__Pyx_XDECREF_SET(__pyx_v_unit, ((PyObject*)__pyx_t_3));
__pyx_t_3 = 0;
/* "osd.pyx":580
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0: # <<<<<<<<<<<<<<
* return "%3.1f %s%s" % (num, unit, suffix)
* num /= 1024.0
*/
__pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_float_1024_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 580, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
/* "osd.pyx":581
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0:
* return "%3.1f %s%s" % (num, unit, suffix) # <<<<<<<<<<<<<<
* num /= 1024.0
* return "%.1f %s%s" % (num, 'Yi', suffix)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = 0;
__pyx_t_7 = 127;
__pyx_t_3 = __Pyx_PyObject_Format(__pyx_v_num, __pyx_kp_u_3_1f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
__pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u__17);
__pyx_t_6 += 1;
__Pyx_GIVEREF(__pyx_kp_u__17);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u__17);
__pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_unit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
__pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_suffix), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
__pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":580
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0: # <<<<<<<<<<<<<<
* return "%3.1f %s%s" % (num, unit, suffix)
* num /= 1024.0
*/
}
/* "osd.pyx":582
* if abs(num) < 1024.0:
* return "%3.1f %s%s" % (num, unit, suffix)
* num /= 1024.0 # <<<<<<<<<<<<<<
* return "%.1f %s%s" % (num, 'Yi', suffix)
*
*/
__pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_num, __pyx_float_1024_0, 1024.0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_num, __pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":579
* def __str__(self):
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: # <<<<<<<<<<<<<<
* if abs(num) < 1024.0:
* return "%3.1f %s%s" % (num, unit, suffix)
*/
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":583
* return "%3.1f %s%s" % (num, unit, suffix)
* num /= 1024.0
* return "%.1f %s%s" % (num, 'Yi', suffix) # <<<<<<<<<<<<<<
*
* str = "Memory connected to MAM module at DI address %d.\n" %\
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = 0;
__pyx_t_7 = 127;
__pyx_t_3 = __Pyx_PyObject_Format(__pyx_v_num, __pyx_kp_u_1f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
__pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u_Yi);
__pyx_t_2 += 3;
__Pyx_GIVEREF(__pyx_kp_u_Yi);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_Yi);
__pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_suffix), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7;
__pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* "osd.pyx":578
*
* def __str__(self):
* def sizeof_fmt(num, suffix='B'): # <<<<<<<<<<<<<<
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0:
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.MemoryDescriptor.__str__.sizeof_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_unit);
__Pyx_XDECREF(__pyx_v_num);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":577
* return self._cself.di_addr
*
* def __str__(self): # <<<<<<<<<<<<<<
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
*/
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_2__str__(struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_v_sizeof_fmt = 0;
PyObject *__pyx_v_str = NULL;
CYTHON_UNUSED PyObject *__pyx_v_regions = NULL;
PyObject *__pyx_v_r_idx = NULL;
PyObject *__pyx_v_r = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
Py_UCS4 __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
Py_ssize_t __pyx_t_7;
PyObject *__pyx_t_8 = NULL;
__Pyx_RefNannySetupContext("__str__", 0);
/* "osd.pyx":578
*
* def __str__(self):
* def sizeof_fmt(num, suffix='B'): # <<<<<<<<<<<<<<
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0:
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_16MemoryDescriptor_7__str___1sizeof_fmt, 0, __pyx_n_s_str___locals_sizeof_fmt, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__20);
__pyx_v_sizeof_fmt = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":586
*
* str = "Memory connected to MAM module at DI address %d.\n" %\
* self.di_addr # <<<<<<<<<<<<<<
* str += "address width = %d bit, data width = %d bit\n" %\
* (self.addr_width_bit, self.data_width_bit)
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_di_addr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
/* "osd.pyx":585
* return "%.1f %s%s" % (num, 'Yi', suffix)
*
* str = "Memory connected to MAM module at DI address %d.\n" %\ # <<<<<<<<<<<<<<
* self.di_addr
* str += "address width = %d bit, data width = %d bit\n" %\
*/
__pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Memory_connected_to_MAM_module_a, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_str = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
/* "osd.pyx":587
* str = "Memory connected to MAM module at DI address %d.\n" %\
* self.di_addr
* str += "address width = %d bit, data width = %d bit\n" %\ # <<<<<<<<<<<<<<
* (self.addr_width_bit, self.data_width_bit)
* regions = self.regions
*/
__pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = 0;
__pyx_t_4 = 127;
__Pyx_INCREF(__pyx_kp_u_address_width);
__pyx_t_3 += 16;
__Pyx_GIVEREF(__pyx_kp_u_address_width);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_address_width);
/* "osd.pyx":588
* self.di_addr
* str += "address width = %d bit, data width = %d bit\n" %\
* (self.addr_width_bit, self.data_width_bit) # <<<<<<<<<<<<<<
* regions = self.regions
* str += "%d region(s):\n" % len(self.regions)
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_addr_width_bit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_n_u_d); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
__pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__pyx_t_5 = 0;
__Pyx_INCREF(__pyx_kp_u_bit_data_width);
__pyx_t_3 += 19;
__Pyx_GIVEREF(__pyx_kp_u_bit_data_width);
PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_bit_data_width);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_data_width_bit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_4;
__pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
__pyx_t_1 = 0;
__Pyx_INCREF(__pyx_kp_u_bit);
__pyx_t_3 += 5;
__Pyx_GIVEREF(__pyx_kp_u_bit);
PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_bit);
/* "osd.pyx":587
* str = "Memory connected to MAM module at DI address %d.\n" %\
* self.di_addr
* str += "address width = %d bit, data width = %d bit\n" %\ # <<<<<<<<<<<<<<
* (self.addr_width_bit, self.data_width_bit)
* regions = self.regions
*/
__pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_v_str, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_str, ((PyObject*)__pyx_t_2));
__pyx_t_2 = 0;
/* "osd.pyx":589
* str += "address width = %d bit, data width = %d bit\n" %\
* (self.addr_width_bit, self.data_width_bit)
* regions = self.regions # <<<<<<<<<<<<<<
* str += "%d region(s):\n" % len(self.regions)
*
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_regions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_regions = __pyx_t_2;
__pyx_t_2 = 0;
/* "osd.pyx":590
* (self.addr_width_bit, self.data_width_bit)
* regions = self.regions
* str += "%d region(s):\n" % len(self.regions) # <<<<<<<<<<<<<<
*
* r_idx = 0
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_regions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 590, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyUnicode_Format(__pyx_kp_u_d_region_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_v_str, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_str, ((PyObject*)__pyx_t_2));
__pyx_t_2 = 0;
/* "osd.pyx":592
* str += "%d region(s):\n" % len(self.regions)
*
* r_idx = 0 # <<<<<<<<<<<<<<
* for r in self.regions:
* str += " %d: base address: 0x%x, size: %s\n" %\
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_v_r_idx = __pyx_int_0;
/* "osd.pyx":593
*
* r_idx = 0
* for r in self.regions: # <<<<<<<<<<<<<<
* str += " %d: base address: 0x%x, size: %s\n" %\
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize']))
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_regions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
__pyx_t_6 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 593, __pyx_L1_error)
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
for (;;) {
if (likely(!__pyx_t_6)) {
if (likely(PyList_CheckExact(__pyx_t_1))) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
} else {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
#endif
}
} else {
__pyx_t_2 = __pyx_t_6(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else __PYX_ERR(0, 593, __pyx_L1_error)
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_2);
__pyx_t_2 = 0;
/* "osd.pyx":594
* r_idx = 0
* for r in self.regions:
* str += " %d: base address: 0x%x, size: %s\n" %\ # <<<<<<<<<<<<<<
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize']))
* r_idx += 1
*/
__pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_7 = 0;
__pyx_t_4 = 127;
__Pyx_INCREF(__pyx_kp_u__21);
__pyx_t_7 += 2;
__Pyx_GIVEREF(__pyx_kp_u__21);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__21);
/* "osd.pyx":595
* for r in self.regions:
* str += " %d: base address: 0x%x, size: %s\n" %\
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize'])) # <<<<<<<<<<<<<<
* r_idx += 1
*
*/
__pyx_t_5 = __Pyx_PyObject_Format(__pyx_v_r_idx, __pyx_n_u_d); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4;
__pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
__pyx_t_5 = 0;
__Pyx_INCREF(__pyx_kp_u_base_address_0x);
__pyx_t_7 += 18;
__Pyx_GIVEREF(__pyx_kp_u_base_address_0x);
PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_base_address_0x);
__pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_r, __pyx_n_u_baseaddr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_4;
__pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
__pyx_t_8 = 0;
__Pyx_INCREF(__pyx_kp_u_size);
__pyx_t_7 += 8;
__Pyx_GIVEREF(__pyx_kp_u_size);
PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_size);
__pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_r, __pyx_n_u_memsize); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_v_sizeof_fmt, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_4;
__pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_8);
__pyx_t_8 = 0;
__Pyx_INCREF(__pyx_kp_u__22);
__pyx_t_7 += 1;
__Pyx_GIVEREF(__pyx_kp_u__22);
PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_kp_u__22);
/* "osd.pyx":594
* r_idx = 0
* for r in self.regions:
* str += " %d: base address: 0x%x, size: %s\n" %\ # <<<<<<<<<<<<<<
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize']))
* r_idx += 1
*/
__pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_2, 7, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 594, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_v_str, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF_SET(__pyx_v_str, ((PyObject*)__pyx_t_2));
__pyx_t_2 = 0;
/* "osd.pyx":596
* str += " %d: base address: 0x%x, size: %s\n" %\
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize']))
* r_idx += 1 # <<<<<<<<<<<<<<
*
* return str
*/
__pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_r_idx, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_r_idx, __pyx_t_2);
__pyx_t_2 = 0;
/* "osd.pyx":593
*
* r_idx = 0
* for r in self.regions: # <<<<<<<<<<<<<<
* str += " %d: base address: 0x%x, size: %s\n" %\
* (r_idx, r['baseaddr'], sizeof_fmt(r['memsize']))
*/
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":598
* r_idx += 1
*
* return str # <<<<<<<<<<<<<<
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_str);
__pyx_r = __pyx_v_str;
goto __pyx_L0;
/* "osd.pyx":577
* return self._cself.di_addr
*
* def __str__(self): # <<<<<<<<<<<<<<
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("osd.MemoryDescriptor.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_sizeof_fmt);
__Pyx_XDECREF(__pyx_v_str);
__Pyx_XDECREF(__pyx_v_regions);
__Pyx_XDECREF(__pyx_v_r_idx);
__Pyx_XDECREF(__pyx_v_r);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_16MemoryDescriptor_4__reduce_cython__[] = "MemoryDescriptor.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_4__reduce_cython__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_16MemoryDescriptor_6__setstate_cython__[] = "MemoryDescriptor.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_16MemoryDescriptor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_16MemoryDescriptor_6__setstate_cython__(((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_16MemoryDescriptor_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryDescriptor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":600
* return str
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr): # <<<<<<<<<<<<<<
* mem_desc = MemoryDescriptor()
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_3cl_mam_get_mem_desc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_2cl_mam_get_mem_desc[] = "cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr)";
static PyMethodDef __pyx_mdef_3osd_3cl_mam_get_mem_desc = {"cl_mam_get_mem_desc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_3cl_mam_get_mem_desc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_2cl_mam_get_mem_desc};
static PyObject *__pyx_pw_3osd_3cl_mam_get_mem_desc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod = 0;
PyObject *__pyx_v_mam_di_addr = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cl_mam_get_mem_desc (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hostmod,&__pyx_n_s_mam_di_addr,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostmod)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mam_di_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_get_mem_desc", 1, 2, 2, 1); __PYX_ERR(0, 600, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cl_mam_get_mem_desc") < 0)) __PYX_ERR(0, 600, __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_hostmod = ((struct __pyx_obj_3osd_Hostmod *)values[0]);
__pyx_v_mam_di_addr = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("cl_mam_get_mem_desc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 600, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.cl_mam_get_mem_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hostmod), __pyx_ptype_3osd_Hostmod, 1, "hostmod", 0))) __PYX_ERR(0, 600, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_2cl_mam_get_mem_desc(__pyx_self, __pyx_v_hostmod, __pyx_v_mam_di_addr);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_2cl_mam_get_mem_desc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_mam_di_addr) {
struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
unsigned int __pyx_t_2;
__Pyx_RefNannySetupContext("cl_mam_get_mem_desc", 0);
/* "osd.pyx":601
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr):
* mem_desc = MemoryDescriptor() # <<<<<<<<<<<<<<
*
* cosd.osd_cl_mam_get_mem_desc(hostmod._cself, mam_di_addr, &mem_desc._cself)
*/
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_3osd_MemoryDescriptor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_mem_desc = ((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_t_1);
__pyx_t_1 = 0;
/* "osd.pyx":603
* mem_desc = MemoryDescriptor()
*
* cosd.osd_cl_mam_get_mem_desc(hostmod._cself, mam_di_addr, &mem_desc._cself) # <<<<<<<<<<<<<<
*
* return mem_desc
*/
__pyx_t_2 = __Pyx_PyInt_As_unsigned_int(__pyx_v_mam_di_addr); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 603, __pyx_L1_error)
(void)(osd_cl_mam_get_mem_desc(__pyx_v_hostmod->_cself, __pyx_t_2, (&__pyx_v_mem_desc->_cself)));
/* "osd.pyx":605
* cosd.osd_cl_mam_get_mem_desc(hostmod._cself, mam_di_addr, &mem_desc._cself)
*
* return mem_desc # <<<<<<<<<<<<<<
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_mem_desc));
__pyx_r = ((PyObject *)__pyx_v_mem_desc);
goto __pyx_L0;
/* "osd.pyx":600
* return str
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr): # <<<<<<<<<<<<<<
* mem_desc = MemoryDescriptor()
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.cl_mam_get_mem_desc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_mem_desc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":607
* return mem_desc
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr): # <<<<<<<<<<<<<<
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_5cl_mam_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_4cl_mam_write[] = "cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr)";
static PyMethodDef __pyx_mdef_3osd_5cl_mam_write = {"cl_mam_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_5cl_mam_write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_4cl_mam_write};
static PyObject *__pyx_pw_3osd_5cl_mam_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc = 0;
struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod = 0;
PyObject *__pyx_v_data = 0;
PyObject *__pyx_v_addr = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cl_mam_write (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mem_desc,&__pyx_n_s_hostmod,&__pyx_n_s_data,&__pyx_n_s_addr,0};
PyObject* values[4] = {0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mem_desc)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostmod)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_write", 1, 4, 4, 1); __PYX_ERR(0, 607, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_write", 1, 4, 4, 2); __PYX_ERR(0, 607, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_write", 1, 4, 4, 3); __PYX_ERR(0, 607, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cl_mam_write") < 0)) __PYX_ERR(0, 607, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
}
__pyx_v_mem_desc = ((struct __pyx_obj_3osd_MemoryDescriptor *)values[0]);
__pyx_v_hostmod = ((struct __pyx_obj_3osd_Hostmod *)values[1]);
__pyx_v_data = values[2];
__pyx_v_addr = values[3];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("cl_mam_write", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 607, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.cl_mam_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mem_desc), __pyx_ptype_3osd_MemoryDescriptor, 1, "mem_desc", 0))) __PYX_ERR(0, 607, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hostmod), __pyx_ptype_3osd_Hostmod, 1, "hostmod", 0))) __PYX_ERR(0, 607, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_4cl_mam_write(__pyx_self, __pyx_v_mem_desc, __pyx_v_hostmod, __pyx_v_data, __pyx_v_addr);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_4cl_mam_write(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_data, PyObject *__pyx_v_addr) {
char *__pyx_v_c_data;
PyObject *__pyx_v_rv = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
char *__pyx_t_1;
Py_ssize_t __pyx_t_2;
uint64_t __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
__Pyx_RefNannySetupContext("cl_mam_write", 0);
/* "osd.pyx":608
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr):
* cdef char* c_data = data # <<<<<<<<<<<<<<
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
* len(data), addr)
*/
__pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 608, __pyx_L1_error)
__pyx_v_c_data = __pyx_t_1;
/* "osd.pyx":610
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
* len(data), addr) # <<<<<<<<<<<<<<
* if rv != 0:
* raise Exception("Memory write failed (%d)" % rv)
*/
__pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 610, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyInt_As_uint64_t(__pyx_v_addr); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 610, __pyx_L1_error)
/* "osd.pyx":609
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr):
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data, # <<<<<<<<<<<<<<
* len(data), addr)
* if rv != 0:
*/
__pyx_t_4 = __Pyx_PyInt_From_osd_result(osd_cl_mam_write((&__pyx_v_mem_desc->_cself), __pyx_v_hostmod->_cself, __pyx_v_c_data, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_rv = __pyx_t_4;
__pyx_t_4 = 0;
/* "osd.pyx":611
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
* len(data), addr)
* if rv != 0: # <<<<<<<<<<<<<<
* raise Exception("Memory write failed (%d)" % rv)
*
*/
__pyx_t_4 = __Pyx_PyInt_NeObjC(__pyx_v_rv, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 611, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(__pyx_t_5)) {
/* "osd.pyx":612
* len(data), addr)
* if rv != 0:
* raise Exception("Memory write failed (%d)" % rv) # <<<<<<<<<<<<<<
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte):
*/
__pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Memory_write_failed_d, __pyx_v_rv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 612, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 612, __pyx_L1_error)
/* "osd.pyx":611
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
* len(data), addr)
* if rv != 0: # <<<<<<<<<<<<<<
* raise Exception("Memory write failed (%d)" % rv)
*
*/
}
/* "osd.pyx":607
* return mem_desc
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr): # <<<<<<<<<<<<<<
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("osd.cl_mam_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_rv);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":614
* raise Exception("Memory write failed (%d)" % rv)
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte): # <<<<<<<<<<<<<<
* data = bytearray(nbyte)
* cdef char* c_data = data
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_7cl_mam_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_6cl_mam_read[] = "cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte)";
static PyMethodDef __pyx_mdef_3osd_7cl_mam_read = {"cl_mam_read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7cl_mam_read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_6cl_mam_read};
static PyObject *__pyx_pw_3osd_7cl_mam_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc = 0;
struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod = 0;
PyObject *__pyx_v_addr = 0;
PyObject *__pyx_v_nbyte = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cl_mam_read (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mem_desc,&__pyx_n_s_hostmod,&__pyx_n_s_addr,&__pyx_n_s_nbyte,0};
PyObject* values[4] = {0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mem_desc)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hostmod)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_read", 1, 4, 4, 1); __PYX_ERR(0, 614, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_read", 1, 4, 4, 2); __PYX_ERR(0, 614, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nbyte)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("cl_mam_read", 1, 4, 4, 3); __PYX_ERR(0, 614, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cl_mam_read") < 0)) __PYX_ERR(0, 614, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
}
__pyx_v_mem_desc = ((struct __pyx_obj_3osd_MemoryDescriptor *)values[0]);
__pyx_v_hostmod = ((struct __pyx_obj_3osd_Hostmod *)values[1]);
__pyx_v_addr = values[2];
__pyx_v_nbyte = values[3];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("cl_mam_read", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 614, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.cl_mam_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mem_desc), __pyx_ptype_3osd_MemoryDescriptor, 1, "mem_desc", 0))) __PYX_ERR(0, 614, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hostmod), __pyx_ptype_3osd_Hostmod, 1, "hostmod", 0))) __PYX_ERR(0, 614, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_6cl_mam_read(__pyx_self, __pyx_v_mem_desc, __pyx_v_hostmod, __pyx_v_addr, __pyx_v_nbyte);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_6cl_mam_read(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, struct __pyx_obj_3osd_Hostmod *__pyx_v_hostmod, PyObject *__pyx_v_addr, PyObject *__pyx_v_nbyte) {
PyObject *__pyx_v_data = NULL;
char *__pyx_v_c_data;
PyObject *__pyx_v_rv = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
char *__pyx_t_2;
size_t __pyx_t_3;
uint64_t __pyx_t_4;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
__Pyx_RefNannySetupContext("cl_mam_read", 0);
/* "osd.pyx":615
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte):
* data = bytearray(nbyte) # <<<<<<<<<<<<<<
* cdef char* c_data = data
*
*/
__pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_v_nbyte); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_data = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
/* "osd.pyx":616
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte):
* data = bytearray(nbyte)
* cdef char* c_data = data # <<<<<<<<<<<<<<
*
* rv = cosd.osd_cl_mam_read(&mem_desc._cself, hostmod._cself, c_data,
*/
__pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_data); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 616, __pyx_L1_error)
__pyx_v_c_data = __pyx_t_2;
/* "osd.pyx":619
*
* rv = cosd.osd_cl_mam_read(&mem_desc._cself, hostmod._cself, c_data,
* nbyte, addr) # <<<<<<<<<<<<<<
* if rv != 0:
* raise Exception("Memory read failed (%d)" % rv)
*/
__pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_nbyte); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 619, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyInt_As_uint64_t(__pyx_v_addr); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 619, __pyx_L1_error)
/* "osd.pyx":618
* cdef char* c_data = data
*
* rv = cosd.osd_cl_mam_read(&mem_desc._cself, hostmod._cself, c_data, # <<<<<<<<<<<<<<
* nbyte, addr)
* if rv != 0:
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(osd_cl_mam_read((&__pyx_v_mem_desc->_cself), __pyx_v_hostmod->_cself, __pyx_v_c_data, __pyx_t_3, __pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_rv = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":620
* rv = cosd.osd_cl_mam_read(&mem_desc._cself, hostmod._cself, c_data,
* nbyte, addr)
* if rv != 0: # <<<<<<<<<<<<<<
* raise Exception("Memory read failed (%d)" % rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_rv, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 620, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(__pyx_t_5)) {
/* "osd.pyx":621
* nbyte, addr)
* if rv != 0:
* raise Exception("Memory read failed (%d)" % rv) # <<<<<<<<<<<<<<
*
* return data
*/
__pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Memory_read_failed_d, __pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 621, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 621, __pyx_L1_error)
/* "osd.pyx":620
* rv = cosd.osd_cl_mam_read(&mem_desc._cself, hostmod._cself, c_data,
* nbyte, addr)
* if rv != 0: # <<<<<<<<<<<<<<
* raise Exception("Memory read failed (%d)" % rv)
*
*/
}
/* "osd.pyx":623
* raise Exception("Memory read failed (%d)" % rv)
*
* return data # <<<<<<<<<<<<<<
*
* cdef class MemoryAccess:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_data);
__pyx_r = __pyx_v_data;
goto __pyx_L0;
/* "osd.pyx":614
* raise Exception("Memory write failed (%d)" % rv)
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte): # <<<<<<<<<<<<<<
* data = bytearray(nbyte)
* cdef char* c_data = data
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("osd.cl_mam_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_data);
__Pyx_XDECREF(__pyx_v_rv);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":628
* cdef cosd.osd_memaccess_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address): # <<<<<<<<<<<<<<
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string
*/
/* Python wrapper */
static int __pyx_pw_3osd_12MemoryAccess_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_12MemoryAccess_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_host_controller_address = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_host_controller_address,0};
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);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host_controller_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 628, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 628, __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_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_host_controller_address = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 628, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.MemoryAccess.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 628, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_12MemoryAccess___cinit__(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), __pyx_v_log, __pyx_v_host_controller_address);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_12MemoryAccess___cinit__(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address) {
PyObject *__pyx_v_py_byte_string = NULL;
char *__pyx_v_c_host_controller_address;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char *__pyx_t_4;
int __pyx_t_5;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":629
*
* def __cinit__(self, Log log, host_controller_address):
* py_byte_string = host_controller_address.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_host_controller_address = py_byte_string
* rv = cosd.osd_memaccess_new(&self._cself, log._cself,
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host_controller_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_py_byte_string = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":630
* def __cinit__(self, Log log, host_controller_address):
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_new(&self._cself, log._cself,
* c_host_controller_address)
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 630, __pyx_L1_error)
__pyx_v_c_host_controller_address = __pyx_t_4;
/* "osd.pyx":631
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string
* rv = cosd.osd_memaccess_new(&self._cself, log._cself, # <<<<<<<<<<<<<<
* c_host_controller_address)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_memaccess_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_v_c_host_controller_address);
/* "osd.pyx":633
* rv = cosd.osd_memaccess_new(&self._cself, log._cself,
* c_host_controller_address)
* check_osd_result(rv) # <<<<<<<<<<<<<<
* if self._cself is NULL:
* raise MemoryError()
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":634
* c_host_controller_address)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_5 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_5)) {
/* "osd.pyx":635
* check_osd_result(rv)
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 635, __pyx_L1_error)
/* "osd.pyx":634
* c_host_controller_address)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":628
* cdef cosd.osd_memaccess_ctx* _cself
*
* def __cinit__(self, Log log, host_controller_address): # <<<<<<<<<<<<<<
* py_byte_string = host_controller_address.encode('UTF-8')
* cdef char* c_host_controller_address = py_byte_string
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.MemoryAccess.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_byte_string);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":637
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_12MemoryAccess_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_12MemoryAccess_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_12MemoryAccess_2__dealloc__(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_12MemoryAccess_2__dealloc__(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":638
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":639
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* if self.is_connected():
*/
goto __pyx_L0;
/* "osd.pyx":638
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":641
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_connected); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 641, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
/* "osd.pyx":642
*
* if self.is_connected():
* self.disconnect() # <<<<<<<<<<<<<<
*
* cosd.osd_memaccess_free(&self._cself)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_disconnect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":641
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
}
/* "osd.pyx":644
* self.disconnect()
*
* cosd.osd_memaccess_free(&self._cself) # <<<<<<<<<<<<<<
*
* def connect(self):
*/
osd_memaccess_free((&__pyx_v_self->_cself));
/* "osd.pyx":637
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("osd.MemoryAccess.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":646
* cosd.osd_memaccess_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_connect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_4connect[] = "MemoryAccess.connect(self)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_4connect(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_4connect(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("connect", 0);
/* "osd.pyx":647
*
* def connect(self):
* rv = cosd.osd_memaccess_connect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_memaccess_connect(__pyx_v_self->_cself);
/* "osd.pyx":648
* def connect(self):
* rv = cosd.osd_memaccess_connect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def disconnect(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":646
* cosd.osd_memaccess_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_connect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.MemoryAccess.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":650
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_disconnect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_6disconnect[] = "MemoryAccess.disconnect(self)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_6disconnect(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_6disconnect(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("disconnect", 0);
/* "osd.pyx":651
*
* def disconnect(self):
* rv = cosd.osd_memaccess_disconnect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_memaccess_disconnect(__pyx_v_self->_cself);
/* "osd.pyx":652
* def disconnect(self):
* rv = cosd.osd_memaccess_disconnect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def is_connected(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":650
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_disconnect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.MemoryAccess.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":654
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_memaccess_is_connected(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_8is_connected[] = "MemoryAccess.is_connected(self)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_8is_connected(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_8is_connected(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_connected", 0);
/* "osd.pyx":655
*
* def is_connected(self):
* return cosd.osd_memaccess_is_connected(self._cself) # <<<<<<<<<<<<<<
*
* def cpus_stop(self, subnet_addr):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_memaccess_is_connected(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":654
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_memaccess_is_connected(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryAccess.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":657
* return cosd.osd_memaccess_is_connected(self._cself)
*
* def cpus_stop(self, subnet_addr): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_cpus_stop(self._cself, subnet_addr)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_11cpus_stop(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_10cpus_stop[] = "MemoryAccess.cpus_stop(self, subnet_addr)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_11cpus_stop(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cpus_stop (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_10cpus_stop(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), ((PyObject *)__pyx_v_subnet_addr));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_10cpus_stop(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("cpus_stop", 0);
/* "osd.pyx":658
*
* def cpus_stop(self, subnet_addr):
* rv = cosd.osd_memaccess_cpus_stop(self._cself, subnet_addr) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_subnet_addr); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L1_error)
__pyx_v_rv = osd_memaccess_cpus_stop(__pyx_v_self->_cself, __pyx_t_1);
/* "osd.pyx":659
* def cpus_stop(self, subnet_addr):
* rv = cosd.osd_memaccess_cpus_stop(self._cself, subnet_addr)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def cpus_start(self, subnet_addr):
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":657
* return cosd.osd_memaccess_is_connected(self._cself)
*
* def cpus_stop(self, subnet_addr): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_cpus_stop(self._cself, subnet_addr)
* check_osd_result(rv)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.MemoryAccess.cpus_stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":661
* check_osd_result(rv)
*
* def cpus_start(self, subnet_addr): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_cpus_start(self._cself, subnet_addr)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_13cpus_start(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_12cpus_start[] = "MemoryAccess.cpus_start(self, subnet_addr)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_13cpus_start(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cpus_start (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_12cpus_start(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), ((PyObject *)__pyx_v_subnet_addr));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_12cpus_start(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
__Pyx_RefNannySetupContext("cpus_start", 0);
/* "osd.pyx":662
*
* def cpus_start(self, subnet_addr):
* rv = cosd.osd_memaccess_cpus_start(self._cself, subnet_addr) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_subnet_addr); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error)
__pyx_v_rv = osd_memaccess_cpus_start(__pyx_v_self->_cself, __pyx_t_1);
/* "osd.pyx":663
* def cpus_start(self, subnet_addr):
* rv = cosd.osd_memaccess_cpus_start(self._cself, subnet_addr)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def find_memories(self, subnet_addr):
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":661
* check_osd_result(rv)
*
* def cpus_start(self, subnet_addr): # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_cpus_start(self._cself, subnet_addr)
* check_osd_result(rv)
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.MemoryAccess.cpus_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":665
* check_osd_result(rv)
*
* def find_memories(self, subnet_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_mem_desc *memories
* cdef size_t num_memories = 0
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_15find_memories(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_14find_memories[] = "MemoryAccess.find_memories(self, subnet_addr)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_15find_memories(PyObject *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("find_memories (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_14find_memories(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), ((PyObject *)__pyx_v_subnet_addr));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_14find_memories(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, PyObject *__pyx_v_subnet_addr) {
struct osd_mem_desc *__pyx_v_memories;
size_t __pyx_v_num_memories;
osd_result __pyx_v_rv;
PyObject *__pyx_v_result_list = NULL;
size_t __pyx_v_m;
struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
unsigned int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
size_t __pyx_t_4;
size_t __pyx_t_5;
size_t __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
char const *__pyx_t_10;
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
PyObject *__pyx_t_14 = NULL;
PyObject *__pyx_t_15 = NULL;
PyObject *__pyx_t_16 = NULL;
__Pyx_RefNannySetupContext("find_memories", 0);
/* "osd.pyx":667
* def find_memories(self, subnet_addr):
* cdef cosd.osd_mem_desc *memories
* cdef size_t num_memories = 0 # <<<<<<<<<<<<<<
* try:
* rv = cosd.osd_memaccess_find_memories(self._cself, subnet_addr,
*/
__pyx_v_num_memories = 0;
/* "osd.pyx":668
* cdef cosd.osd_mem_desc *memories
* cdef size_t num_memories = 0
* try: # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_find_memories(self._cself, subnet_addr,
* &memories,
*/
/*try:*/ {
/* "osd.pyx":669
* cdef size_t num_memories = 0
* try:
* rv = cosd.osd_memaccess_find_memories(self._cself, subnet_addr, # <<<<<<<<<<<<<<
* &memories,
* &num_memories)
*/
__pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_subnet_addr); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L4_error)
/* "osd.pyx":671
* rv = cosd.osd_memaccess_find_memories(self._cself, subnet_addr,
* &memories,
* &num_memories) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_memaccess_find_memories(__pyx_v_self->_cself, __pyx_t_1, (&__pyx_v_memories), (&__pyx_v_num_memories));
/* "osd.pyx":672
* &memories,
* &num_memories)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* result_list = []
*/
__pyx_t_2 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 672, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":674
* check_osd_result(rv)
*
* result_list = [] # <<<<<<<<<<<<<<
* for m in range(num_memories):
* mem_desc = MemoryDescriptor()
*/
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_result_list = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
/* "osd.pyx":675
*
* result_list = []
* for m in range(num_memories): # <<<<<<<<<<<<<<
* mem_desc = MemoryDescriptor()
* mem_desc._cself = memories[m]
*/
__pyx_t_4 = __pyx_v_num_memories;
__pyx_t_5 = __pyx_t_4;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_m = __pyx_t_6;
/* "osd.pyx":676
* result_list = []
* for m in range(num_memories):
* mem_desc = MemoryDescriptor() # <<<<<<<<<<<<<<
* mem_desc._cself = memories[m]
* result_list.append(mem_desc)
*/
__pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_3osd_MemoryDescriptor)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_mem_desc, ((struct __pyx_obj_3osd_MemoryDescriptor *)__pyx_t_3));
__pyx_t_3 = 0;
/* "osd.pyx":677
* for m in range(num_memories):
* mem_desc = MemoryDescriptor()
* mem_desc._cself = memories[m] # <<<<<<<<<<<<<<
* result_list.append(mem_desc)
* finally:
*/
__pyx_v_mem_desc->_cself = (__pyx_v_memories[__pyx_v_m]);
/* "osd.pyx":678
* mem_desc = MemoryDescriptor()
* mem_desc._cself = memories[m]
* result_list.append(mem_desc) # <<<<<<<<<<<<<<
* finally:
* free(memories)
*/
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_result_list, ((PyObject *)__pyx_v_mem_desc)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 678, __pyx_L4_error)
}
}
/* "osd.pyx":680
* result_list.append(mem_desc)
* finally:
* free(memories) # <<<<<<<<<<<<<<
*
* return result_list
*/
/*finally:*/ {
/*normal exit:*/{
free(__pyx_v_memories);
goto __pyx_L5;
}
__pyx_L4_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
__Pyx_XGOTREF(__pyx_t_11);
__Pyx_XGOTREF(__pyx_t_12);
__Pyx_XGOTREF(__pyx_t_13);
__Pyx_XGOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
{
free(__pyx_v_memories);
}
if (PY_MAJOR_VERSION >= 3) {
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
}
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
__pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
__pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
goto __pyx_L1_error;
}
__pyx_L5:;
}
/* "osd.pyx":682
* free(memories)
*
* return result_list # <<<<<<<<<<<<<<
*
* def loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_result_list);
__pyx_r = __pyx_v_result_list;
goto __pyx_L0;
/* "osd.pyx":665
* check_osd_result(rv)
*
* def find_memories(self, subnet_addr): # <<<<<<<<<<<<<<
* cdef cosd.osd_mem_desc *memories
* cdef size_t num_memories = 0
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.MemoryAccess.find_memories", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_result_list);
__Pyx_XDECREF((PyObject *)__pyx_v_mem_desc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":684
* return result_list
*
* def loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify): # <<<<<<<<<<<<<<
* py_byte_string = elf_file_path.encode('UTF-8')
* cdef char* c_elf_file_path = py_byte_string
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_17loadelf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_16loadelf[] = "MemoryAccess.loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_17loadelf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc = 0;
PyObject *__pyx_v_elf_file_path = 0;
PyObject *__pyx_v_verify = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("loadelf (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mem_desc,&__pyx_n_s_elf_file_path,&__pyx_n_s_verify,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mem_desc)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elf_file_path)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("loadelf", 1, 3, 3, 1); __PYX_ERR(0, 684, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verify)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("loadelf", 1, 3, 3, 2); __PYX_ERR(0, 684, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loadelf") < 0)) __PYX_ERR(0, 684, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_mem_desc = ((struct __pyx_obj_3osd_MemoryDescriptor *)values[0]);
__pyx_v_elf_file_path = values[1];
__pyx_v_verify = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("loadelf", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 684, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.MemoryAccess.loadelf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mem_desc), __pyx_ptype_3osd_MemoryDescriptor, 1, "mem_desc", 0))) __PYX_ERR(0, 684, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_12MemoryAccess_16loadelf(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), __pyx_v_mem_desc, __pyx_v_elf_file_path, __pyx_v_verify);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_16loadelf(struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, struct __pyx_obj_3osd_MemoryDescriptor *__pyx_v_mem_desc, PyObject *__pyx_v_elf_file_path, PyObject *__pyx_v_verify) {
PyObject *__pyx_v_py_byte_string = NULL;
char *__pyx_v_c_elf_file_path;
int __pyx_v_c_verify;
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char *__pyx_t_4;
int __pyx_t_5;
__Pyx_RefNannySetupContext("loadelf", 0);
/* "osd.pyx":685
*
* def loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify):
* py_byte_string = elf_file_path.encode('UTF-8') # <<<<<<<<<<<<<<
* cdef char* c_elf_file_path = py_byte_string
* cdef int c_verify = verify
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_elf_file_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_py_byte_string = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":686
* def loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify):
* py_byte_string = elf_file_path.encode('UTF-8')
* cdef char* c_elf_file_path = py_byte_string # <<<<<<<<<<<<<<
* cdef int c_verify = verify
*
*/
__pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 686, __pyx_L1_error)
__pyx_v_c_elf_file_path = __pyx_t_4;
/* "osd.pyx":687
* py_byte_string = elf_file_path.encode('UTF-8')
* cdef char* c_elf_file_path = py_byte_string
* cdef int c_verify = verify # <<<<<<<<<<<<<<
*
* with nogil:
*/
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_verify); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error)
__pyx_v_c_verify = __pyx_t_5;
/* "osd.pyx":689
* cdef int c_verify = verify
*
* with nogil: # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_loadelf(self._cself, &mem_desc._cself,
* c_elf_file_path, c_verify)
*/
{
#ifdef WITH_THREAD
PyThreadState *_save;
Py_UNBLOCK_THREADS
__Pyx_FastGIL_Remember();
#endif
/*try:*/ {
/* "osd.pyx":690
*
* with nogil:
* rv = cosd.osd_memaccess_loadelf(self._cself, &mem_desc._cself, # <<<<<<<<<<<<<<
* c_elf_file_path, c_verify)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_memaccess_loadelf(__pyx_v_self->_cself, (&__pyx_v_mem_desc->_cself), __pyx_v_c_elf_file_path, __pyx_v_c_verify);
}
/* "osd.pyx":689
* cdef int c_verify = verify
*
* with nogil: # <<<<<<<<<<<<<<
* rv = cosd.osd_memaccess_loadelf(self._cself, &mem_desc._cself,
* c_elf_file_path, c_verify)
*/
/*finally:*/ {
/*normal exit:*/{
#ifdef WITH_THREAD
__Pyx_FastGIL_Forget();
Py_BLOCK_THREADS
#endif
goto __pyx_L5;
}
__pyx_L5:;
}
}
/* "osd.pyx":692
* rv = cosd.osd_memaccess_loadelf(self._cself, &mem_desc._cself,
* c_elf_file_path, c_verify)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":684
* return result_list
*
* def loadelf(self, MemoryDescriptor mem_desc, elf_file_path, verify): # <<<<<<<<<<<<<<
* py_byte_string = elf_file_path.encode('UTF-8')
* cdef char* c_elf_file_path = py_byte_string
*/
/* function exit code */
__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_AddTraceback("osd.MemoryAccess.loadelf", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_py_byte_string);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_18__reduce_cython__[] = "MemoryAccess.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_19__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_18__reduce_cython__(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_18__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryAccess.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_12MemoryAccess_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_12MemoryAccess_20__setstate_cython__[] = "MemoryAccess.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_12MemoryAccess_21__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_12MemoryAccess_20__setstate_cython__(((struct __pyx_obj_3osd_MemoryAccess *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_12MemoryAccess_20__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_MemoryAccess *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.MemoryAccess.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":703
* cdef _event_file
*
* def __cinit__(self, Log log, host_controller_address, di_addr): # <<<<<<<<<<<<<<
* self._fp_sysprint = NULL
* self._fp_event = NULL
*/
/* Python wrapper */
static int __pyx_pw_3osd_14SystraceLogger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_14SystraceLogger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_host_controller_address = 0;
PyObject *__pyx_v_di_addr = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_host_controller_address,&__pyx_n_s_di_addr,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host_controller_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 703, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_di_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 703, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 703, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_host_controller_address = values[1];
__pyx_v_di_addr = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 703, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.SystraceLogger.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 703, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_14SystraceLogger___cinit__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self), __pyx_v_log, __pyx_v_host_controller_address, __pyx_v_di_addr);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_14SystraceLogger___cinit__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_di_addr) {
PyObject *__pyx_v_b_host_controller_address = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char const *__pyx_t_4;
uint16_t __pyx_t_5;
int __pyx_t_6;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":704
*
* def __cinit__(self, Log log, host_controller_address, di_addr):
* self._fp_sysprint = NULL # <<<<<<<<<<<<<<
* self._fp_event = NULL
* self._sysprint_file = None
*/
__pyx_v_self->_fp_sysprint = NULL;
/* "osd.pyx":705
* def __cinit__(self, Log log, host_controller_address, di_addr):
* self._fp_sysprint = NULL
* self._fp_event = NULL # <<<<<<<<<<<<<<
* self._sysprint_file = None
* self._event_file = None
*/
__pyx_v_self->_fp_event = NULL;
/* "osd.pyx":706
* self._fp_sysprint = NULL
* self._fp_event = NULL
* self._sysprint_file = None # <<<<<<<<<<<<<<
* self._event_file = None
*
*/
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->_sysprint_file);
__Pyx_DECREF(__pyx_v_self->_sysprint_file);
__pyx_v_self->_sysprint_file = Py_None;
/* "osd.pyx":707
* self._fp_event = NULL
* self._sysprint_file = None
* self._event_file = None # <<<<<<<<<<<<<<
*
* b_host_controller_address = host_controller_address.encode('UTF-8')
*/
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->_event_file);
__Pyx_DECREF(__pyx_v_self->_event_file);
__pyx_v_self->_event_file = Py_None;
/* "osd.pyx":709
* self._event_file = None
*
* b_host_controller_address = host_controller_address.encode('UTF-8') # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr)
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host_controller_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_b_host_controller_address = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":711
* b_host_controller_address = host_controller_address.encode('UTF-8')
* rv = cosd.osd_systracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr) # <<<<<<<<<<<<<<
* check_osd_result(rv)
* if self._cself is NULL:
*/
__pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_b_host_controller_address); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error)
__pyx_t_5 = __Pyx_PyInt_As_uint16_t(__pyx_v_di_addr); if (unlikely((__pyx_t_5 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error)
/* "osd.pyx":710
*
* b_host_controller_address = host_controller_address.encode('UTF-8')
* rv = cosd.osd_systracelogger_new(&self._cself, log._cself, # <<<<<<<<<<<<<<
* b_host_controller_address, di_addr)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_systracelogger_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_t_4, __pyx_t_5);
/* "osd.pyx":712
* rv = cosd.osd_systracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr)
* check_osd_result(rv) # <<<<<<<<<<<<<<
* if self._cself is NULL:
* raise MemoryError()
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":713
* b_host_controller_address, di_addr)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_6 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_6)) {
/* "osd.pyx":714
* check_osd_result(rv)
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 714, __pyx_L1_error)
/* "osd.pyx":713
* b_host_controller_address, di_addr)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":703
* cdef _event_file
*
* def __cinit__(self, Log log, host_controller_address, di_addr): # <<<<<<<<<<<<<<
* self._fp_sysprint = NULL
* self._fp_event = NULL
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.SystraceLogger.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_host_controller_address);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":716
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_14SystraceLogger_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_14SystraceLogger_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_14SystraceLogger_2__dealloc__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_14SystraceLogger_2__dealloc__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":717
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":718
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* if self.is_connected():
*/
goto __pyx_L0;
/* "osd.pyx":717
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":720
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_connected); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 720, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 720, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
/* "osd.pyx":721
*
* if self.is_connected():
* self.disconnect() # <<<<<<<<<<<<<<
*
* cosd.osd_systracelogger_free(&self._cself)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_disconnect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":720
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
}
/* "osd.pyx":723
* self.disconnect()
*
* cosd.osd_systracelogger_free(&self._cself) # <<<<<<<<<<<<<<
*
* if self._fp_sysprint:
*/
osd_systracelogger_free((&__pyx_v_self->_cself));
/* "osd.pyx":725
* cosd.osd_systracelogger_free(&self._cself)
*
* if self._fp_sysprint: # <<<<<<<<<<<<<<
* fclose(self._fp_sysprint)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_sysprint != 0);
if (__pyx_t_1) {
/* "osd.pyx":726
*
* if self._fp_sysprint:
* fclose(self._fp_sysprint) # <<<<<<<<<<<<<<
*
* if self._fp_event:
*/
(void)(fclose(__pyx_v_self->_fp_sysprint));
/* "osd.pyx":725
* cosd.osd_systracelogger_free(&self._cself)
*
* if self._fp_sysprint: # <<<<<<<<<<<<<<
* fclose(self._fp_sysprint)
*
*/
}
/* "osd.pyx":728
* fclose(self._fp_sysprint)
*
* if self._fp_event: # <<<<<<<<<<<<<<
* fclose(self._fp_event)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_event != 0);
if (__pyx_t_1) {
/* "osd.pyx":729
*
* if self._fp_event:
* fclose(self._fp_event) # <<<<<<<<<<<<<<
*
* def connect(self):
*/
(void)(fclose(__pyx_v_self->_fp_event));
/* "osd.pyx":728
* fclose(self._fp_sysprint)
*
* if self._fp_event: # <<<<<<<<<<<<<<
* fclose(self._fp_event)
*
*/
}
/* "osd.pyx":716
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("osd.SystraceLogger.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":731
* fclose(self._fp_event)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_connect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_4connect[] = "SystraceLogger.connect(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_4connect(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_4connect(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("connect", 0);
/* "osd.pyx":732
*
* def connect(self):
* rv = cosd.osd_systracelogger_connect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_systracelogger_connect(__pyx_v_self->_cself);
/* "osd.pyx":733
* def connect(self):
* rv = cosd.osd_systracelogger_connect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def disconnect(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":731
* fclose(self._fp_event)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_connect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.SystraceLogger.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":735
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_disconnect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_6disconnect[] = "SystraceLogger.disconnect(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_6disconnect(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_6disconnect(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("disconnect", 0);
/* "osd.pyx":736
*
* def disconnect(self):
* rv = cosd.osd_systracelogger_disconnect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_systracelogger_disconnect(__pyx_v_self->_cself);
/* "osd.pyx":737
* def disconnect(self):
* rv = cosd.osd_systracelogger_disconnect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def is_connected(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":735
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_disconnect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.SystraceLogger.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":739
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_systracelogger_is_connected(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_8is_connected[] = "SystraceLogger.is_connected(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_8is_connected(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_8is_connected(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_connected", 0);
/* "osd.pyx":740
*
* def is_connected(self):
* return cosd.osd_systracelogger_is_connected(self._cself) # <<<<<<<<<<<<<<
*
* def stop(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_systracelogger_is_connected(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":739
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_systracelogger_is_connected(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.SystraceLogger.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":742
* return cosd.osd_systracelogger_is_connected(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_stop(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_11stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_10stop[] = "SystraceLogger.stop(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_11stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("stop (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_10stop(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_10stop(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("stop", 0);
/* "osd.pyx":743
*
* def stop(self):
* rv = cosd.osd_systracelogger_stop(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_systracelogger_stop(__pyx_v_self->_cself);
/* "osd.pyx":744
* def stop(self):
* rv = cosd.osd_systracelogger_stop(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def start(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":742
* return cosd.osd_systracelogger_is_connected(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_stop(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.SystraceLogger.stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":746
* check_osd_result(rv)
*
* def start(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_start(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_13start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_12start[] = "SystraceLogger.start(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_13start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("start (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_12start(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_12start(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("start", 0);
/* "osd.pyx":747
*
* def start(self):
* rv = cosd.osd_systracelogger_start(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_systracelogger_start(__pyx_v_self->_cself);
/* "osd.pyx":748
* def start(self):
* rv = cosd.osd_systracelogger_start(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":746
* check_osd_result(rv)
*
* def start(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_systracelogger_start(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.SystraceLogger.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":751
*
* @property
* def sysprint_log(self): # <<<<<<<<<<<<<<
* return self._sysprint_file
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_12sysprint_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_14SystraceLogger_12sysprint_log_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_12sysprint_log___get__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_12sysprint_log___get__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":752
* @property
* def sysprint_log(self):
* return self._sysprint_file # <<<<<<<<<<<<<<
*
* @sysprint_log.setter
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_sysprint_file);
__pyx_r = __pyx_v_self->_sysprint_file;
goto __pyx_L0;
/* "osd.pyx":751
*
* @property
* def sysprint_log(self): # <<<<<<<<<<<<<<
* return self._sysprint_file
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":755
*
* @sysprint_log.setter
* def sysprint_log(self, log_filename): # <<<<<<<<<<<<<<
* self._sysprint_file = log_filename
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_14SystraceLogger_12sysprint_log_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename); /*proto*/
static int __pyx_pw_3osd_14SystraceLogger_12sysprint_log_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_12sysprint_log_2__set__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v_log_filename));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_14SystraceLogger_12sysprint_log_2__set__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename) {
PyObject *__pyx_v_b_log_filename = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
char const *__pyx_t_5;
char *__pyx_t_6;
__Pyx_RefNannySetupContext("__set__", 0);
/* "osd.pyx":756
* @sysprint_log.setter
* def sysprint_log(self, log_filename):
* self._sysprint_file = log_filename # <<<<<<<<<<<<<<
*
* if self._fp_sysprint:
*/
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
__Pyx_GOTREF(__pyx_v_self->_sysprint_file);
__Pyx_DECREF(__pyx_v_self->_sysprint_file);
__pyx_v_self->_sysprint_file = __pyx_v_log_filename;
/* "osd.pyx":758
* self._sysprint_file = log_filename
*
* if self._fp_sysprint: # <<<<<<<<<<<<<<
* fclose(self._fp_sysprint)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_sysprint != 0);
if (__pyx_t_1) {
/* "osd.pyx":759
*
* if self._fp_sysprint:
* fclose(self._fp_sysprint) # <<<<<<<<<<<<<<
*
* b_log_filename = os.fsencode(log_filename)
*/
(void)(fclose(__pyx_v_self->_fp_sysprint));
/* "osd.pyx":758
* self._sysprint_file = log_filename
*
* if self._fp_sysprint: # <<<<<<<<<<<<<<
* fclose(self._fp_sysprint)
*
*/
}
/* "osd.pyx":761
* fclose(self._fp_sysprint)
*
* b_log_filename = os.fsencode(log_filename) # <<<<<<<<<<<<<<
* self._fp_sysprint = fopen(b_log_filename, 'w')
* if not self._fp_sysprint:
*/
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_log_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_log_filename);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_b_log_filename = __pyx_t_2;
__pyx_t_2 = 0;
/* "osd.pyx":762
*
* b_log_filename = os.fsencode(log_filename)
* self._fp_sysprint = fopen(b_log_filename, 'w') # <<<<<<<<<<<<<<
* if not self._fp_sysprint:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*/
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_b_log_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
__pyx_v_self->_fp_sysprint = fopen(__pyx_t_5, ((char const *)"w"));
/* "osd.pyx":763
* b_log_filename = os.fsencode(log_filename)
* self._fp_sysprint = fopen(b_log_filename, 'w')
* if not self._fp_sysprint: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
__pyx_t_1 = ((!(__pyx_v_self->_fp_sysprint != 0)) != 0);
if (unlikely(__pyx_t_1)) {
/* "osd.pyx":764
* self._fp_sysprint = fopen(b_log_filename, 'w')
* if not self._fp_sysprint:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename) # <<<<<<<<<<<<<<
*
* rv = cosd.osd_systracelogger_set_sysprint_log(self._cself,
*/
__pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = strerror(errno);
__pyx_t_4 = __Pyx_decode_c_string(__pyx_t_6, 0, strlen(__pyx_t_6), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_log_filename);
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 764, __pyx_L1_error)
/* "osd.pyx":763
* b_log_filename = os.fsencode(log_filename)
* self._fp_sysprint = fopen(b_log_filename, 'w')
* if not self._fp_sysprint: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
}
/* "osd.pyx":766
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
* rv = cosd.osd_systracelogger_set_sysprint_log(self._cself, # <<<<<<<<<<<<<<
* self._fp_sysprint)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_systracelogger_set_sysprint_log(__pyx_v_self->_cself, __pyx_v_self->_fp_sysprint);
/* "osd.pyx":768
* rv = cosd.osd_systracelogger_set_sysprint_log(self._cself,
* self._fp_sysprint)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_4 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 768, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":755
*
* @sysprint_log.setter
* def sysprint_log(self, log_filename): # <<<<<<<<<<<<<<
* self._sysprint_file = log_filename
*
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.SystraceLogger.sysprint_log.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_log_filename);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":771
*
* @property
* def event_log(self): # <<<<<<<<<<<<<<
* return self._event_file
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_9event_log_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_14SystraceLogger_9event_log_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_9event_log___get__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_9event_log___get__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":772
* @property
* def event_log(self):
* return self._event_file # <<<<<<<<<<<<<<
*
* @event_log.setter
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_event_file);
__pyx_r = __pyx_v_self->_event_file;
goto __pyx_L0;
/* "osd.pyx":771
*
* @property
* def event_log(self): # <<<<<<<<<<<<<<
* return self._event_file
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":775
*
* @event_log.setter
* def event_log(self, log_filename): # <<<<<<<<<<<<<<
* self._event_file = log_filename
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_14SystraceLogger_9event_log_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename); /*proto*/
static int __pyx_pw_3osd_14SystraceLogger_9event_log_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_9event_log_2__set__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v_log_filename));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_14SystraceLogger_9event_log_2__set__(struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename) {
PyObject *__pyx_v_b_log_filename = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
char const *__pyx_t_5;
char *__pyx_t_6;
__Pyx_RefNannySetupContext("__set__", 0);
/* "osd.pyx":776
* @event_log.setter
* def event_log(self, log_filename):
* self._event_file = log_filename # <<<<<<<<<<<<<<
*
* if self._fp_event:
*/
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
__Pyx_GOTREF(__pyx_v_self->_event_file);
__Pyx_DECREF(__pyx_v_self->_event_file);
__pyx_v_self->_event_file = __pyx_v_log_filename;
/* "osd.pyx":778
* self._event_file = log_filename
*
* if self._fp_event: # <<<<<<<<<<<<<<
* fclose(self._fp_event)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_event != 0);
if (__pyx_t_1) {
/* "osd.pyx":779
*
* if self._fp_event:
* fclose(self._fp_event) # <<<<<<<<<<<<<<
*
* b_log_filename = os.fsencode(log_filename)
*/
(void)(fclose(__pyx_v_self->_fp_event));
/* "osd.pyx":778
* self._event_file = log_filename
*
* if self._fp_event: # <<<<<<<<<<<<<<
* fclose(self._fp_event)
*
*/
}
/* "osd.pyx":781
* fclose(self._fp_event)
*
* b_log_filename = os.fsencode(log_filename) # <<<<<<<<<<<<<<
* self._fp_event = fopen(b_log_filename, 'w')
* if not self._fp_event:
*/
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_log_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_log_filename);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_b_log_filename = __pyx_t_2;
__pyx_t_2 = 0;
/* "osd.pyx":782
*
* b_log_filename = os.fsencode(log_filename)
* self._fp_event = fopen(b_log_filename, 'w') # <<<<<<<<<<<<<<
* if not self._fp_event:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*/
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_b_log_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 782, __pyx_L1_error)
__pyx_v_self->_fp_event = fopen(__pyx_t_5, ((char const *)"w"));
/* "osd.pyx":783
* b_log_filename = os.fsencode(log_filename)
* self._fp_event = fopen(b_log_filename, 'w')
* if not self._fp_event: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
__pyx_t_1 = ((!(__pyx_v_self->_fp_event != 0)) != 0);
if (unlikely(__pyx_t_1)) {
/* "osd.pyx":784
* self._fp_event = fopen(b_log_filename, 'w')
* if not self._fp_event:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename) # <<<<<<<<<<<<<<
*
* rv = cosd.osd_systracelogger_set_event_log(self._cself, self._fp_event)
*/
__pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = strerror(errno);
__pyx_t_4 = __Pyx_decode_c_string(__pyx_t_6, 0, strlen(__pyx_t_6), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_log_filename);
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 784, __pyx_L1_error)
/* "osd.pyx":783
* b_log_filename = os.fsencode(log_filename)
* self._fp_event = fopen(b_log_filename, 'w')
* if not self._fp_event: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
}
/* "osd.pyx":786
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
* rv = cosd.osd_systracelogger_set_event_log(self._cself, self._fp_event) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_systracelogger_set_event_log(__pyx_v_self->_cself, __pyx_v_self->_fp_event);
/* "osd.pyx":787
*
* rv = cosd.osd_systracelogger_set_event_log(self._cself, self._fp_event)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_4 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":775
*
* @event_log.setter
* def event_log(self, log_filename): # <<<<<<<<<<<<<<
* self._event_file = log_filename
*
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.SystraceLogger.event_log.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_log_filename);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_14__reduce_cython__[] = "SystraceLogger.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_14__reduce_cython__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.SystraceLogger.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_14SystraceLogger_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_14SystraceLogger_16__setstate_cython__[] = "SystraceLogger.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_14SystraceLogger_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_14SystraceLogger_16__setstate_cython__(((struct __pyx_obj_3osd_SystraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_14SystraceLogger_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_SystraceLogger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.SystraceLogger.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":796
* cdef _elf_file
*
* def __cinit__(self, Log log, host_controller_address, di_addr): # <<<<<<<<<<<<<<
* self._fp_log = NULL
* self._log_file = None
*/
/* Python wrapper */
static int __pyx_pw_3osd_15CoretraceLogger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3osd_15CoretraceLogger_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_3osd_Log *__pyx_v_log = 0;
PyObject *__pyx_v_host_controller_address = 0;
PyObject *__pyx_v_di_addr = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_log,&__pyx_n_s_host_controller_address,&__pyx_n_s_di_addr,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_log)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host_controller_address)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 796, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_di_addr)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 796, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 796, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v_log = ((struct __pyx_obj_3osd_Log *)values[0]);
__pyx_v_host_controller_address = values[1];
__pyx_v_di_addr = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 796, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.CoretraceLogger.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log), __pyx_ptype_3osd_Log, 1, "log", 0))) __PYX_ERR(0, 796, __pyx_L1_error)
__pyx_r = __pyx_pf_3osd_15CoretraceLogger___cinit__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self), __pyx_v_log, __pyx_v_host_controller_address, __pyx_v_di_addr);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_15CoretraceLogger___cinit__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, struct __pyx_obj_3osd_Log *__pyx_v_log, PyObject *__pyx_v_host_controller_address, PyObject *__pyx_v_di_addr) {
PyObject *__pyx_v_b_host_controller_address = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char const *__pyx_t_4;
uint16_t __pyx_t_5;
int __pyx_t_6;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "osd.pyx":797
*
* def __cinit__(self, Log log, host_controller_address, di_addr):
* self._fp_log = NULL # <<<<<<<<<<<<<<
* self._log_file = None
*
*/
__pyx_v_self->_fp_log = NULL;
/* "osd.pyx":798
* def __cinit__(self, Log log, host_controller_address, di_addr):
* self._fp_log = NULL
* self._log_file = None # <<<<<<<<<<<<<<
*
* b_host_controller_address = host_controller_address.encode('UTF-8')
*/
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->_log_file);
__Pyx_DECREF(__pyx_v_self->_log_file);
__pyx_v_self->_log_file = Py_None;
/* "osd.pyx":800
* self._log_file = None
*
* b_host_controller_address = host_controller_address.encode('UTF-8') # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr)
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_host_controller_address, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_b_host_controller_address = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":802
* b_host_controller_address = host_controller_address.encode('UTF-8')
* rv = cosd.osd_coretracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr) # <<<<<<<<<<<<<<
* check_osd_result(rv)
* if self._cself is NULL:
*/
__pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_b_host_controller_address); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L1_error)
__pyx_t_5 = __Pyx_PyInt_As_uint16_t(__pyx_v_di_addr); if (unlikely((__pyx_t_5 == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L1_error)
/* "osd.pyx":801
*
* b_host_controller_address = host_controller_address.encode('UTF-8')
* rv = cosd.osd_coretracelogger_new(&self._cself, log._cself, # <<<<<<<<<<<<<<
* b_host_controller_address, di_addr)
* check_osd_result(rv)
*/
__pyx_v_rv = osd_coretracelogger_new((&__pyx_v_self->_cself), __pyx_v_log->_cself, __pyx_t_4, __pyx_t_5);
/* "osd.pyx":803
* rv = cosd.osd_coretracelogger_new(&self._cself, log._cself,
* b_host_controller_address, di_addr)
* check_osd_result(rv) # <<<<<<<<<<<<<<
* if self._cself is NULL:
* raise MemoryError()
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":804
* b_host_controller_address, di_addr)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
__pyx_t_6 = ((__pyx_v_self->_cself == NULL) != 0);
if (unlikely(__pyx_t_6)) {
/* "osd.pyx":805
* check_osd_result(rv)
* if self._cself is NULL:
* raise MemoryError() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
PyErr_NoMemory(); __PYX_ERR(0, 805, __pyx_L1_error)
/* "osd.pyx":804
* b_host_controller_address, di_addr)
* check_osd_result(rv)
* if self._cself is NULL: # <<<<<<<<<<<<<<
* raise MemoryError()
*
*/
}
/* "osd.pyx":796
* cdef _elf_file
*
* def __cinit__(self, Log log, host_controller_address, di_addr): # <<<<<<<<<<<<<<
* self._fp_log = NULL
* self._log_file = None
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.CoretraceLogger.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_host_controller_address);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":807
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* Python wrapper */
static void __pyx_pw_3osd_15CoretraceLogger_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3osd_15CoretraceLogger_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_3osd_15CoretraceLogger_2__dealloc__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_3osd_15CoretraceLogger_2__dealloc__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "osd.pyx":808
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
__pyx_t_1 = ((__pyx_v_self->_cself == NULL) != 0);
if (__pyx_t_1) {
/* "osd.pyx":809
* def __dealloc__(self):
* if self._cself is NULL:
* return # <<<<<<<<<<<<<<
*
* if self.is_connected():
*/
goto __pyx_L0;
/* "osd.pyx":808
*
* def __dealloc__(self):
* if self._cself is NULL: # <<<<<<<<<<<<<<
* return
*
*/
}
/* "osd.pyx":811
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_connected); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 811, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
/* "osd.pyx":812
*
* if self.is_connected():
* self.disconnect() # <<<<<<<<<<<<<<
*
* if self._fp_log:
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_disconnect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 812, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":811
* return
*
* if self.is_connected(): # <<<<<<<<<<<<<<
* self.disconnect()
*
*/
}
/* "osd.pyx":814
* self.disconnect()
*
* if self._fp_log: # <<<<<<<<<<<<<<
* fclose(self._fp_log)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_log != 0);
if (__pyx_t_1) {
/* "osd.pyx":815
*
* if self._fp_log:
* fclose(self._fp_log) # <<<<<<<<<<<<<<
*
* cosd.osd_coretracelogger_free(&self._cself)
*/
(void)(fclose(__pyx_v_self->_fp_log));
/* "osd.pyx":814
* self.disconnect()
*
* if self._fp_log: # <<<<<<<<<<<<<<
* fclose(self._fp_log)
*
*/
}
/* "osd.pyx":817
* fclose(self._fp_log)
*
* cosd.osd_coretracelogger_free(&self._cself) # <<<<<<<<<<<<<<
*
* def connect(self):
*/
osd_coretracelogger_free((&__pyx_v_self->_cself));
/* "osd.pyx":807
* raise MemoryError()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* if self._cself is NULL:
* return
*/
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("osd.CoretraceLogger.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
/* "osd.pyx":819
* cosd.osd_coretracelogger_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_connect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_4connect[] = "CoretraceLogger.connect(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("connect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_4connect(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_4connect(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("connect", 0);
/* "osd.pyx":820
*
* def connect(self):
* rv = cosd.osd_coretracelogger_connect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_coretracelogger_connect(__pyx_v_self->_cself);
/* "osd.pyx":821
* def connect(self):
* rv = cosd.osd_coretracelogger_connect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def disconnect(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":819
* cosd.osd_coretracelogger_free(&self._cself)
*
* def connect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_connect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.CoretraceLogger.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":823
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_disconnect(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_6disconnect[] = "CoretraceLogger.disconnect(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_7disconnect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_6disconnect(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_6disconnect(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("disconnect", 0);
/* "osd.pyx":824
*
* def disconnect(self):
* rv = cosd.osd_coretracelogger_disconnect(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_coretracelogger_disconnect(__pyx_v_self->_cself);
/* "osd.pyx":825
* def disconnect(self):
* rv = cosd.osd_coretracelogger_disconnect(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def is_connected(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":823
* check_osd_result(rv)
*
* def disconnect(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_disconnect(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.CoretraceLogger.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":827
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_coretracelogger_is_connected(self._cself)
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_8is_connected[] = "CoretraceLogger.is_connected(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_9is_connected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_connected (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_8is_connected(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8is_connected(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("is_connected", 0);
/* "osd.pyx":828
*
* def is_connected(self):
* return cosd.osd_coretracelogger_is_connected(self._cself) # <<<<<<<<<<<<<<
*
* def stop(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyInt_From_int(osd_coretracelogger_is_connected(__pyx_v_self->_cself)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* "osd.pyx":827
* check_osd_result(rv)
*
* def is_connected(self): # <<<<<<<<<<<<<<
* return cosd.osd_coretracelogger_is_connected(self._cself)
*
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.CoretraceLogger.is_connected", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":830
* return cosd.osd_coretracelogger_is_connected(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_stop(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_11stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_10stop[] = "CoretraceLogger.stop(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_11stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("stop (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_10stop(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_10stop(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("stop", 0);
/* "osd.pyx":831
*
* def stop(self):
* rv = cosd.osd_coretracelogger_stop(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_coretracelogger_stop(__pyx_v_self->_cself);
/* "osd.pyx":832
* def stop(self):
* rv = cosd.osd_coretracelogger_stop(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* def start(self):
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":830
* return cosd.osd_coretracelogger_is_connected(self._cself)
*
* def stop(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_stop(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.CoretraceLogger.stop", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":834
* check_osd_result(rv)
*
* def start(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_start(self._cself)
* check_osd_result(rv)
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_13start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_12start[] = "CoretraceLogger.start(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_13start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("start (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_12start(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_12start(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
osd_result __pyx_v_rv;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
__Pyx_RefNannySetupContext("start", 0);
/* "osd.pyx":835
*
* def start(self):
* rv = cosd.osd_coretracelogger_start(self._cself) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_coretracelogger_start(__pyx_v_self->_cself);
/* "osd.pyx":836
* def start(self):
* rv = cosd.osd_coretracelogger_start(self._cself)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":834
* check_osd_result(rv)
*
* def start(self): # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_start(self._cself)
* check_osd_result(rv)
*/
/* function exit code */
__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("osd.CoretraceLogger.start", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":839
*
* @property
* def log_file(self): # <<<<<<<<<<<<<<
* return self._log_file
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_8log_file_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_15CoretraceLogger_8log_file_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_8log_file___get__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8log_file___get__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":840
* @property
* def log_file(self):
* return self._log_file # <<<<<<<<<<<<<<
*
* @log_file.setter
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_log_file);
__pyx_r = __pyx_v_self->_log_file;
goto __pyx_L0;
/* "osd.pyx":839
*
* @property
* def log_file(self): # <<<<<<<<<<<<<<
* return self._log_file
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":843
*
* @log_file.setter
* def log_file(self, log_filename): # <<<<<<<<<<<<<<
* self._log_file = log_filename
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_15CoretraceLogger_8log_file_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename); /*proto*/
static int __pyx_pw_3osd_15CoretraceLogger_8log_file_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_log_filename) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_8log_file_2__set__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v_log_filename));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_15CoretraceLogger_8log_file_2__set__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, PyObject *__pyx_v_log_filename) {
PyObject *__pyx_v_b_log_filename = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
char const *__pyx_t_5;
char *__pyx_t_6;
__Pyx_RefNannySetupContext("__set__", 0);
/* "osd.pyx":844
* @log_file.setter
* def log_file(self, log_filename):
* self._log_file = log_filename # <<<<<<<<<<<<<<
*
* if self._fp_log:
*/
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
__Pyx_GOTREF(__pyx_v_self->_log_file);
__Pyx_DECREF(__pyx_v_self->_log_file);
__pyx_v_self->_log_file = __pyx_v_log_filename;
/* "osd.pyx":846
* self._log_file = log_filename
*
* if self._fp_log: # <<<<<<<<<<<<<<
* fclose(self._fp_log)
*
*/
__pyx_t_1 = (__pyx_v_self->_fp_log != 0);
if (__pyx_t_1) {
/* "osd.pyx":847
*
* if self._fp_log:
* fclose(self._fp_log) # <<<<<<<<<<<<<<
*
* b_log_filename = os.fsencode(log_filename)
*/
(void)(fclose(__pyx_v_self->_fp_log));
/* "osd.pyx":846
* self._log_file = log_filename
*
* if self._fp_log: # <<<<<<<<<<<<<<
* fclose(self._fp_log)
*
*/
}
/* "osd.pyx":849
* fclose(self._fp_log)
*
* b_log_filename = os.fsencode(log_filename) # <<<<<<<<<<<<<<
* self._fp_log = fopen(b_log_filename, 'w')
* if not self._fp_log:
*/
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
}
}
__pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_log_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_log_filename);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_b_log_filename = __pyx_t_2;
__pyx_t_2 = 0;
/* "osd.pyx":850
*
* b_log_filename = os.fsencode(log_filename)
* self._fp_log = fopen(b_log_filename, 'w') # <<<<<<<<<<<<<<
* if not self._fp_log:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*/
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_b_log_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error)
__pyx_v_self->_fp_log = fopen(__pyx_t_5, ((char const *)"w"));
/* "osd.pyx":851
* b_log_filename = os.fsencode(log_filename)
* self._fp_log = fopen(b_log_filename, 'w')
* if not self._fp_log: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
__pyx_t_1 = ((!(__pyx_v_self->_fp_log != 0)) != 0);
if (unlikely(__pyx_t_1)) {
/* "osd.pyx":852
* self._fp_log = fopen(b_log_filename, 'w')
* if not self._fp_log:
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename) # <<<<<<<<<<<<<<
*
* rv = cosd.osd_coretracelogger_set_log(self._cself, self._fp_log)
*/
__pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 852, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = strerror(errno);
__pyx_t_4 = __Pyx_decode_c_string(__pyx_t_6, 0, strlen(__pyx_t_6), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
__Pyx_INCREF(__pyx_v_log_filename);
__Pyx_GIVEREF(__pyx_v_log_filename);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_log_filename);
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 852, __pyx_L1_error)
/* "osd.pyx":851
* b_log_filename = os.fsencode(log_filename)
* self._fp_log = fopen(b_log_filename, 'w')
* if not self._fp_log: # <<<<<<<<<<<<<<
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
*/
}
/* "osd.pyx":854
* raise IOError(errno, strerror(errno).decode('utf-8'), log_filename)
*
* rv = cosd.osd_coretracelogger_set_log(self._cself, self._fp_log) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*
*/
__pyx_v_rv = osd_coretracelogger_set_log(__pyx_v_self->_cself, __pyx_v_self->_fp_log);
/* "osd.pyx":855
*
* rv = cosd.osd_coretracelogger_set_log(self._cself, self._fp_log)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*
* @property
*/
__pyx_t_4 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":843
*
* @log_file.setter
* def log_file(self, log_filename): # <<<<<<<<<<<<<<
* self._log_file = log_filename
*
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("osd.CoretraceLogger.log_file.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_log_filename);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":858
*
* @property
* def elf_file(self): # <<<<<<<<<<<<<<
* return self._elf_file
*
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_8elf_file_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3osd_15CoretraceLogger_8elf_file_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_8elf_file___get__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_8elf_file___get__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "osd.pyx":859
* @property
* def elf_file(self):
* return self._elf_file # <<<<<<<<<<<<<<
*
* @elf_file.setter
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_elf_file);
__pyx_r = __pyx_v_self->_elf_file;
goto __pyx_L0;
/* "osd.pyx":858
*
* @property
* def elf_file(self): # <<<<<<<<<<<<<<
* return self._elf_file
*
*/
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "osd.pyx":862
*
* @elf_file.setter
* def elf_file(self, elf_filename): # <<<<<<<<<<<<<<
* self._elf_file = elf_filename
*
*/
/* Python wrapper */
static int __pyx_pw_3osd_15CoretraceLogger_8elf_file_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_elf_filename); /*proto*/
static int __pyx_pw_3osd_15CoretraceLogger_8elf_file_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_elf_filename) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_8elf_file_2__set__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v_elf_filename));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_3osd_15CoretraceLogger_8elf_file_2__set__(struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, PyObject *__pyx_v_elf_filename) {
PyObject *__pyx_v_b_filename = NULL;
osd_result __pyx_v_rv;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
char const *__pyx_t_4;
__Pyx_RefNannySetupContext("__set__", 0);
/* "osd.pyx":863
* @elf_file.setter
* def elf_file(self, elf_filename):
* self._elf_file = elf_filename # <<<<<<<<<<<<<<
*
* b_filename = os.fsencode(elf_filename)
*/
__Pyx_INCREF(__pyx_v_elf_filename);
__Pyx_GIVEREF(__pyx_v_elf_filename);
__Pyx_GOTREF(__pyx_v_self->_elf_file);
__Pyx_DECREF(__pyx_v_self->_elf_file);
__pyx_v_self->_elf_file = __pyx_v_elf_filename;
/* "osd.pyx":865
* self._elf_file = elf_filename
*
* b_filename = os.fsencode(elf_filename) # <<<<<<<<<<<<<<
* rv = cosd.osd_coretracelogger_set_elf(self._cself, b_filename)
* check_osd_result(rv)
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 865, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_elf_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_elf_filename);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_b_filename = __pyx_t_1;
__pyx_t_1 = 0;
/* "osd.pyx":866
*
* b_filename = os.fsencode(elf_filename)
* rv = cosd.osd_coretracelogger_set_elf(self._cself, b_filename) # <<<<<<<<<<<<<<
* check_osd_result(rv)
*/
__pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_b_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error)
__pyx_v_rv = osd_coretracelogger_set_elf(__pyx_v_self->_cself, __pyx_t_4);
/* "osd.pyx":867
* b_filename = os.fsencode(elf_filename)
* rv = cosd.osd_coretracelogger_set_elf(self._cself, b_filename)
* check_osd_result(rv) # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyInt_From_osd_result(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __pyx_f_3osd_check_osd_result(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":862
*
* @elf_file.setter
* def elf_file(self, elf_filename): # <<<<<<<<<<<<<<
* self._elf_file = elf_filename
*
*/
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("osd.CoretraceLogger.elf_file.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_b_filename);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_14__reduce_cython__[] = "CoretraceLogger.__reduce_cython__(self)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_14__reduce_cython__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__reduce_cython__", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 2, __pyx_L1_error)
/* "(tree fragment)":1
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.CoretraceLogger.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_15CoretraceLogger_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static char __pyx_doc_3osd_15CoretraceLogger_16__setstate_cython__[] = "CoretraceLogger.__setstate_cython__(self, __pyx_state)";
static PyObject *__pyx_pw_3osd_15CoretraceLogger_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
__pyx_r = __pyx_pf_3osd_15CoretraceLogger_16__setstate_cython__(((struct __pyx_obj_3osd_CoretraceLogger *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_15CoretraceLogger_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_3osd_CoretraceLogger *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannySetupContext("__setstate_cython__", 0);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 4, __pyx_L1_error)
/* "(tree fragment)":3
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("osd.CoretraceLogger.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":1
* def __pyx_unpickle_Module(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
* cdef object __pyx_PickleError
* cdef object __pyx_result
*/
/* Python wrapper */
static PyObject *__pyx_pw_3osd_9__pyx_unpickle_Module(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3osd_8__pyx_unpickle_Module[] = "__pyx_unpickle_Module(__pyx_type, long __pyx_checksum, __pyx_state)";
static PyMethodDef __pyx_mdef_3osd_9__pyx_unpickle_Module = {"__pyx_unpickle_Module", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_9__pyx_unpickle_Module, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_8__pyx_unpickle_Module};
static PyObject *__pyx_pw_3osd_9__pyx_unpickle_Module(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v___pyx_type = 0;
long __pyx_v___pyx_checksum;
PyObject *__pyx_v___pyx_state = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_unpickle_Module (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
PyObject* values[3] = {0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Module", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Module", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Module") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
}
__pyx_v___pyx_type = values[0];
__pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
__pyx_v___pyx_state = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Module", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("osd.__pyx_unpickle_Module", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_3osd_8__pyx_unpickle_Module(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_3osd_8__pyx_unpickle_Module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_v___pyx_PickleError = 0;
PyObject *__pyx_v___pyx_result = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
__Pyx_RefNannySetupContext("__pyx_unpickle_Module", 0);
/* "(tree fragment)":4
* cdef object __pyx_PickleError
* cdef object __pyx_result
* if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<<
* from pickle import PickleError as __pyx_PickleError
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
*/
__pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
if (__pyx_t_1) {
/* "(tree fragment)":5
* cdef object __pyx_result
* if __pyx_checksum != 0xd41d8cd:
* from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
* __pyx_result = Module.__new__(__pyx_type)
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_n_s_PickleError);
__Pyx_GIVEREF(__pyx_n_s_PickleError);
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
__pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_t_2);
__pyx_v___pyx_PickleError = __pyx_t_2;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "(tree fragment)":6
* if __pyx_checksum != 0xd41d8cd:
* from pickle import PickleError as __pyx_PickleError
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) # <<<<<<<<<<<<<<
* __pyx_result = Module.__new__(__pyx_type)
* if __pyx_state is not None:
*/
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_INCREF(__pyx_v___pyx_PickleError);
__pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(1, 6, __pyx_L1_error)
/* "(tree fragment)":4
* cdef object __pyx_PickleError
* cdef object __pyx_result
* if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<<
* from pickle import PickleError as __pyx_PickleError
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
*/
}
/* "(tree fragment)":7
* from pickle import PickleError as __pyx_PickleError
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
* __pyx_result = Module.__new__(__pyx_type) # <<<<<<<<<<<<<<
* if __pyx_state is not None:
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_3osd_Module), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
}
}
__pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v___pyx_result = __pyx_t_3;
__pyx_t_3 = 0;
/* "(tree fragment)":8
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
* __pyx_result = Module.__new__(__pyx_type)
* if __pyx_state is not None: # <<<<<<<<<<<<<<
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
* return __pyx_result
*/
__pyx_t_1 = (__pyx_v___pyx_state != Py_None);
__pyx_t_6 = (__pyx_t_1 != 0);
if (__pyx_t_6) {
/* "(tree fragment)":9
* __pyx_result = Module.__new__(__pyx_type)
* if __pyx_state is not None:
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
* return __pyx_result
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state):
*/
if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
__pyx_t_3 = __pyx_f_3osd___pyx_unpickle_Module__set_state(((struct __pyx_obj_3osd_Module *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "(tree fragment)":8
* raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
* __pyx_result = Module.__new__(__pyx_type)
* if __pyx_state is not None: # <<<<<<<<<<<<<<
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
* return __pyx_result
*/
}
/* "(tree fragment)":10
* if __pyx_state is not None:
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
* return __pyx_result # <<<<<<<<<<<<<<
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state):
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v___pyx_result);
__pyx_r = __pyx_v___pyx_result;
goto __pyx_L0;
/* "(tree fragment)":1
* def __pyx_unpickle_Module(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
* cdef object __pyx_PickleError
* cdef object __pyx_result
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("osd.__pyx_unpickle_Module", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v___pyx_PickleError);
__Pyx_XDECREF(__pyx_v___pyx_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "(tree fragment)":11
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
* return __pyx_result
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
* __pyx_result.__dict__.update(__pyx_state[0])
*/
static PyObject *__pyx_f_3osd___pyx_unpickle_Module__set_state(struct __pyx_obj_3osd_Module *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
Py_ssize_t __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
__Pyx_RefNannySetupContext("__pyx_unpickle_Module__set_state", 0);
/* "(tree fragment)":12
* return __pyx_result
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state):
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
* __pyx_result.__dict__.update(__pyx_state[0])
*/
if (unlikely(__pyx_v___pyx_state == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(1, 12, __pyx_L1_error)
}
__pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
__pyx_t_3 = ((__pyx_t_2 > 0) != 0);
if (__pyx_t_3) {
} else {
__pyx_t_1 = __pyx_t_3;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error)
__pyx_t_4 = (__pyx_t_3 != 0);
__pyx_t_1 = __pyx_t_4;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* "(tree fragment)":13
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state):
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
* __pyx_result.__dict__.update(__pyx_state[0]) # <<<<<<<<<<<<<<
*/
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(__pyx_v___pyx_state == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(1, 13, __pyx_L1_error)
}
__pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_8 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_8)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
}
}
__pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "(tree fragment)":12
* return __pyx_result
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state):
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
* __pyx_result.__dict__.update(__pyx_state[0])
*/
}
/* "(tree fragment)":11
* __pyx_unpickle_Module__set_state(<Module> __pyx_result, __pyx_state)
* return __pyx_result
* cdef __pyx_unpickle_Module__set_state(Module __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
* if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
* __pyx_result.__dict__.update(__pyx_state[0])
*/
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("osd.__pyx_unpickle_Module__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_tp_new_3osd_Log(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_3Log_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_Log(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
(*Py_TYPE(o)->tp_free)(o);
}
static PyMethodDef __pyx_methods_3osd_Log[] = {
{"__dealloc", (PyCFunction)__pyx_pw_3osd_3Log_3__dealloc, METH_NOARGS, __pyx_doc_3osd_3Log_2__dealloc},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_3Log_5__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_3Log_4__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_3Log_7__setstate_cython__, METH_O, __pyx_doc_3osd_3Log_6__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_Log = {
PyVarObject_HEAD_INIT(0, 0)
"osd.Log", /*tp_name*/
sizeof(struct __pyx_obj_3osd_Log), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_Log, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_Log, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_Log, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_PacketType(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_3osd_PacketType(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_10PacketType_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_3osd_PacketType(PyObject *o, Py_ssize_t i) {
PyObject *r;
PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
Py_DECREF(x);
return r;
}
static int __pyx_mp_ass_subscript_3osd_PacketType(PyObject *o, PyObject *i, PyObject *v) {
if (v) {
return __pyx_pw_3osd_10PacketType_9__setitem__(o, i, v);
}
else {
return __pyx_pw_3osd_10PacketType_11__delitem__(o, i);
}
}
static PyObject *__pyx_getprop_3osd_10PacketType_src(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_10PacketType_3src_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_10PacketType_dest(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_10PacketType_4dest_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_10PacketType_type(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_10PacketType_4type_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_10PacketType_type_sub(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_10PacketType_8type_sub_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_10PacketType_payload(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_10PacketType_7payload_1__get__(o);
}
static PyMethodDef __pyx_methods_3osd_PacketType[] = {
{"_ensure_cself", (PyCFunction)__pyx_pw_3osd_10PacketType_1_ensure_cself, METH_NOARGS, __pyx_doc_3osd_10PacketType__ensure_cself},
{"insert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_10PacketType_13insert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_10PacketType_12insert},
{"set_header", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_10PacketType_15set_header, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_10PacketType_14set_header},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_10PacketType_19__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_10PacketType_18__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_10PacketType_21__setstate_cython__, METH_O, __pyx_doc_3osd_10PacketType_20__setstate_cython__},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_3osd_PacketType[] = {
{(char *)"src", __pyx_getprop_3osd_10PacketType_src, 0, (char *)0, 0},
{(char *)"dest", __pyx_getprop_3osd_10PacketType_dest, 0, (char *)0, 0},
{(char *)"type", __pyx_getprop_3osd_10PacketType_type, 0, (char *)0, 0},
{(char *)"type_sub", __pyx_getprop_3osd_10PacketType_type_sub, 0, (char *)0, 0},
{(char *)"payload", __pyx_getprop_3osd_10PacketType_payload, 0, (char *)0, 0},
{0, 0, 0, 0, 0}
};
static PySequenceMethods __pyx_tp_as_sequence_PacketType = {
__pyx_pw_3osd_10PacketType_5__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
__pyx_sq_item_3osd_PacketType, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_PacketType = {
__pyx_pw_3osd_10PacketType_5__len__, /*mp_length*/
__pyx_pw_3osd_10PacketType_7__getitem__, /*mp_subscript*/
__pyx_mp_ass_subscript_3osd_PacketType, /*mp_ass_subscript*/
};
static PyTypeObject __pyx_type_3osd_PacketType = {
PyVarObject_HEAD_INIT(0, 0)
"osd.PacketType", /*tp_name*/
sizeof(struct __pyx_obj_3osd_PacketType), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_PacketType, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
&__pyx_tp_as_sequence_PacketType, /*tp_as_sequence*/
&__pyx_tp_as_mapping_PacketType, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
__pyx_pw_3osd_10PacketType_17__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_PacketType, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_3osd_PacketType, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_PacketType, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_Packet(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = __pyx_tp_new_3osd_PacketType(t, a, k);
if (unlikely(!o)) return 0;
return o;
}
static PyMethodDef __pyx_methods_3osd_Packet[] = {
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_6Packet_1__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_6Packet___reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_6Packet_3__setstate_cython__, METH_O, __pyx_doc_3osd_6Packet_2__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_Packet = {
PyVarObject_HEAD_INIT(0, 0)
"osd.Packet", /*tp_name*/
sizeof(struct __pyx_obj_3osd_Packet), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_PacketType, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
#if CYTHON_COMPILING_IN_PYPY
__pyx_pw_3osd_10PacketType_17__str__, /*tp_str*/
#else
0, /*tp_str*/
#endif
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_Packet, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_Packet, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_Hostmod(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_7Hostmod_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_Hostmod(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_7Hostmod_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_getprop_3osd_7Hostmod_diaddr(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_7Hostmod_6diaddr_1__get__(o);
}
static PyMethodDef __pyx_methods_3osd_Hostmod[] = {
{"connect", (PyCFunction)__pyx_pw_3osd_7Hostmod_5connect, METH_NOARGS, __pyx_doc_3osd_7Hostmod_4connect},
{"disconnect", (PyCFunction)__pyx_pw_3osd_7Hostmod_7disconnect, METH_NOARGS, __pyx_doc_3osd_7Hostmod_6disconnect},
{"is_connected", (PyCFunction)__pyx_pw_3osd_7Hostmod_9is_connected, METH_NOARGS, __pyx_doc_3osd_7Hostmod_8is_connected},
{"reg_read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7Hostmod_11reg_read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_7Hostmod_10reg_read},
{"reg_write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7Hostmod_13reg_write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_7Hostmod_12reg_write},
{"get_modules", (PyCFunction)__pyx_pw_3osd_7Hostmod_15get_modules, METH_O, __pyx_doc_3osd_7Hostmod_14get_modules},
{"mod_describe", (PyCFunction)__pyx_pw_3osd_7Hostmod_17mod_describe, METH_O, __pyx_doc_3osd_7Hostmod_16mod_describe},
{"mod_set_event_dest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7Hostmod_19mod_set_event_dest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_7Hostmod_18mod_set_event_dest},
{"mod_set_event_active", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7Hostmod_21mod_set_event_active, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_7Hostmod_20mod_set_event_active},
{"get_max_event_words", (PyCFunction)__pyx_pw_3osd_7Hostmod_23get_max_event_words, METH_O, __pyx_doc_3osd_7Hostmod_22get_max_event_words},
{"event_send", (PyCFunction)__pyx_pw_3osd_7Hostmod_25event_send, METH_O, __pyx_doc_3osd_7Hostmod_24event_send},
{"event_receive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_7Hostmod_27event_receive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_7Hostmod_26event_receive},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_7Hostmod_29__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_7Hostmod_28__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_7Hostmod_31__setstate_cython__, METH_O, __pyx_doc_3osd_7Hostmod_30__setstate_cython__},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_3osd_Hostmod[] = {
{(char *)"diaddr", __pyx_getprop_3osd_7Hostmod_diaddr, 0, (char *)0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_Hostmod = {
PyVarObject_HEAD_INIT(0, 0)
"osd.Hostmod", /*tp_name*/
sizeof(struct __pyx_obj_3osd_Hostmod), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_Hostmod, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_Hostmod, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_3osd_Hostmod, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_Hostmod, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_GatewayGlip(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_11GatewayGlip_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_GatewayGlip(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_11GatewayGlip_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
static PyMethodDef __pyx_methods_3osd_GatewayGlip[] = {
{"connect", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_5connect, METH_NOARGS, __pyx_doc_3osd_11GatewayGlip_4connect},
{"disconnect", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_7disconnect, METH_NOARGS, __pyx_doc_3osd_11GatewayGlip_6disconnect},
{"is_connected", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_9is_connected, METH_NOARGS, __pyx_doc_3osd_11GatewayGlip_8is_connected},
{"get_transfer_stats", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_11get_transfer_stats, METH_NOARGS, __pyx_doc_3osd_11GatewayGlip_10get_transfer_stats},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_13__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_11GatewayGlip_12__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_11GatewayGlip_15__setstate_cython__, METH_O, __pyx_doc_3osd_11GatewayGlip_14__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_GatewayGlip = {
PyVarObject_HEAD_INIT(0, 0)
"osd.GatewayGlip", /*tp_name*/
sizeof(struct __pyx_obj_3osd_GatewayGlip), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_GatewayGlip, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_GatewayGlip, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_GatewayGlip, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_Hostctrl(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_8Hostctrl_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_Hostctrl(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_8Hostctrl_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
static PyMethodDef __pyx_methods_3osd_Hostctrl[] = {
{"start", (PyCFunction)__pyx_pw_3osd_8Hostctrl_5start, METH_NOARGS, __pyx_doc_3osd_8Hostctrl_4start},
{"stop", (PyCFunction)__pyx_pw_3osd_8Hostctrl_7stop, METH_NOARGS, __pyx_doc_3osd_8Hostctrl_6stop},
{"is_running", (PyCFunction)__pyx_pw_3osd_8Hostctrl_9is_running, METH_NOARGS, __pyx_doc_3osd_8Hostctrl_8is_running},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_8Hostctrl_11__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_8Hostctrl_10__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_8Hostctrl_13__setstate_cython__, METH_O, __pyx_doc_3osd_8Hostctrl_12__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_Hostctrl = {
PyVarObject_HEAD_INIT(0, 0)
"osd.Hostctrl", /*tp_name*/
sizeof(struct __pyx_obj_3osd_Hostctrl), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_Hostctrl, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_Hostctrl, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_Hostctrl, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_Module(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_3osd_Module(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
(*Py_TYPE(o)->tp_free)(o);
}
static PyMethodDef __pyx_methods_3osd_Module[] = {
{"get_type_short_name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_6Module_1get_type_short_name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_6Module_get_type_short_name},
{"get_type_long_name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_6Module_3get_type_long_name, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_6Module_2get_type_long_name},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_6Module_5__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_6Module_4__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_6Module_7__setstate_cython__, METH_O, __pyx_doc_3osd_6Module_6__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_Module = {
PyVarObject_HEAD_INIT(0, 0)
"osd.Module", /*tp_name*/
sizeof(struct __pyx_obj_3osd_Module), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_Module, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_Module, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_Module, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_MemoryDescriptor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_16MemoryDescriptor_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_MemoryDescriptor(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
(*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_getprop_3osd_16MemoryDescriptor_regions(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_16MemoryDescriptor_7regions_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_16MemoryDescriptor_addr_width_bit(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_16MemoryDescriptor_14addr_width_bit_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_16MemoryDescriptor_data_width_bit(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_16MemoryDescriptor_14data_width_bit_1__get__(o);
}
static PyObject *__pyx_getprop_3osd_16MemoryDescriptor_di_addr(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_16MemoryDescriptor_7di_addr_1__get__(o);
}
static PyMethodDef __pyx_methods_3osd_MemoryDescriptor[] = {
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_16MemoryDescriptor_5__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_16MemoryDescriptor_4__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_16MemoryDescriptor_7__setstate_cython__, METH_O, __pyx_doc_3osd_16MemoryDescriptor_6__setstate_cython__},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_3osd_MemoryDescriptor[] = {
{(char *)"regions", __pyx_getprop_3osd_16MemoryDescriptor_regions, 0, (char *)0, 0},
{(char *)"addr_width_bit", __pyx_getprop_3osd_16MemoryDescriptor_addr_width_bit, 0, (char *)0, 0},
{(char *)"data_width_bit", __pyx_getprop_3osd_16MemoryDescriptor_data_width_bit, 0, (char *)0, 0},
{(char *)"di_addr", __pyx_getprop_3osd_16MemoryDescriptor_di_addr, 0, (char *)0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_MemoryDescriptor = {
PyVarObject_HEAD_INIT(0, 0)
"osd.MemoryDescriptor", /*tp_name*/
sizeof(struct __pyx_obj_3osd_MemoryDescriptor), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_MemoryDescriptor, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
__pyx_pw_3osd_16MemoryDescriptor_3__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_MemoryDescriptor, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_3osd_MemoryDescriptor, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_MemoryDescriptor, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_MemoryAccess(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
if (unlikely(__pyx_pw_3osd_12MemoryAccess_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_MemoryAccess(PyObject *o) {
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_12MemoryAccess_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
static PyMethodDef __pyx_methods_3osd_MemoryAccess[] = {
{"connect", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_5connect, METH_NOARGS, __pyx_doc_3osd_12MemoryAccess_4connect},
{"disconnect", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_7disconnect, METH_NOARGS, __pyx_doc_3osd_12MemoryAccess_6disconnect},
{"is_connected", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_9is_connected, METH_NOARGS, __pyx_doc_3osd_12MemoryAccess_8is_connected},
{"cpus_stop", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_11cpus_stop, METH_O, __pyx_doc_3osd_12MemoryAccess_10cpus_stop},
{"cpus_start", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_13cpus_start, METH_O, __pyx_doc_3osd_12MemoryAccess_12cpus_start},
{"find_memories", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_15find_memories, METH_O, __pyx_doc_3osd_12MemoryAccess_14find_memories},
{"loadelf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3osd_12MemoryAccess_17loadelf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_3osd_12MemoryAccess_16loadelf},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_19__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_12MemoryAccess_18__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_12MemoryAccess_21__setstate_cython__, METH_O, __pyx_doc_3osd_12MemoryAccess_20__setstate_cython__},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_MemoryAccess = {
PyVarObject_HEAD_INIT(0, 0)
"osd.MemoryAccess", /*tp_name*/
sizeof(struct __pyx_obj_3osd_MemoryAccess), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_MemoryAccess, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_MemoryAccess, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_MemoryAccess, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_SystraceLogger(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_3osd_SystraceLogger *p;
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
p = ((struct __pyx_obj_3osd_SystraceLogger *)o);
p->_sysprint_file = Py_None; Py_INCREF(Py_None);
p->_event_file = Py_None; Py_INCREF(Py_None);
if (unlikely(__pyx_pw_3osd_14SystraceLogger_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_SystraceLogger(PyObject *o) {
struct __pyx_obj_3osd_SystraceLogger *p = (struct __pyx_obj_3osd_SystraceLogger *)o;
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
PyObject_GC_UnTrack(o);
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_14SystraceLogger_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->_sysprint_file);
Py_CLEAR(p->_event_file);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_3osd_SystraceLogger(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_3osd_SystraceLogger *p = (struct __pyx_obj_3osd_SystraceLogger *)o;
if (p->_sysprint_file) {
e = (*v)(p->_sysprint_file, a); if (e) return e;
}
if (p->_event_file) {
e = (*v)(p->_event_file, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_3osd_SystraceLogger(PyObject *o) {
PyObject* tmp;
struct __pyx_obj_3osd_SystraceLogger *p = (struct __pyx_obj_3osd_SystraceLogger *)o;
tmp = ((PyObject*)p->_sysprint_file);
p->_sysprint_file = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_event_file);
p->_event_file = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static PyObject *__pyx_getprop_3osd_14SystraceLogger_sysprint_log(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_14SystraceLogger_12sysprint_log_1__get__(o);
}
static int __pyx_setprop_3osd_14SystraceLogger_sysprint_log(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_3osd_14SystraceLogger_12sysprint_log_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
static PyObject *__pyx_getprop_3osd_14SystraceLogger_event_log(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_14SystraceLogger_9event_log_1__get__(o);
}
static int __pyx_setprop_3osd_14SystraceLogger_event_log(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_3osd_14SystraceLogger_9event_log_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
static PyMethodDef __pyx_methods_3osd_SystraceLogger[] = {
{"connect", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_5connect, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_4connect},
{"disconnect", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_7disconnect, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_6disconnect},
{"is_connected", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_9is_connected, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_8is_connected},
{"stop", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_11stop, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_10stop},
{"start", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_13start, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_12start},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_15__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_14SystraceLogger_14__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_14SystraceLogger_17__setstate_cython__, METH_O, __pyx_doc_3osd_14SystraceLogger_16__setstate_cython__},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_3osd_SystraceLogger[] = {
{(char *)"sysprint_log", __pyx_getprop_3osd_14SystraceLogger_sysprint_log, __pyx_setprop_3osd_14SystraceLogger_sysprint_log, (char *)0, 0},
{(char *)"event_log", __pyx_getprop_3osd_14SystraceLogger_event_log, __pyx_setprop_3osd_14SystraceLogger_event_log, (char *)0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_SystraceLogger = {
PyVarObject_HEAD_INIT(0, 0)
"osd.SystraceLogger", /*tp_name*/
sizeof(struct __pyx_obj_3osd_SystraceLogger), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_SystraceLogger, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_3osd_SystraceLogger, /*tp_traverse*/
__pyx_tp_clear_3osd_SystraceLogger, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_SystraceLogger, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_3osd_SystraceLogger, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_SystraceLogger, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyObject *__pyx_tp_new_3osd_CoretraceLogger(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_3osd_CoretraceLogger *p;
PyObject *o;
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
} else {
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
if (unlikely(!o)) return 0;
p = ((struct __pyx_obj_3osd_CoretraceLogger *)o);
p->_log_file = Py_None; Py_INCREF(Py_None);
p->_elf_file = Py_None; Py_INCREF(Py_None);
if (unlikely(__pyx_pw_3osd_15CoretraceLogger_1__cinit__(o, a, k) < 0)) goto bad;
return o;
bad:
Py_DECREF(o); o = 0;
return NULL;
}
static void __pyx_tp_dealloc_3osd_CoretraceLogger(PyObject *o) {
struct __pyx_obj_3osd_CoretraceLogger *p = (struct __pyx_obj_3osd_CoretraceLogger *)o;
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
PyObject_GC_UnTrack(o);
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_3osd_15CoretraceLogger_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->_log_file);
Py_CLEAR(p->_elf_file);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_3osd_CoretraceLogger(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_3osd_CoretraceLogger *p = (struct __pyx_obj_3osd_CoretraceLogger *)o;
if (p->_log_file) {
e = (*v)(p->_log_file, a); if (e) return e;
}
if (p->_elf_file) {
e = (*v)(p->_elf_file, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_3osd_CoretraceLogger(PyObject *o) {
PyObject* tmp;
struct __pyx_obj_3osd_CoretraceLogger *p = (struct __pyx_obj_3osd_CoretraceLogger *)o;
tmp = ((PyObject*)p->_log_file);
p->_log_file = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_elf_file);
p->_elf_file = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static PyObject *__pyx_getprop_3osd_15CoretraceLogger_log_file(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_15CoretraceLogger_8log_file_1__get__(o);
}
static int __pyx_setprop_3osd_15CoretraceLogger_log_file(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_3osd_15CoretraceLogger_8log_file_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
static PyObject *__pyx_getprop_3osd_15CoretraceLogger_elf_file(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_pw_3osd_15CoretraceLogger_8elf_file_1__get__(o);
}
static int __pyx_setprop_3osd_15CoretraceLogger_elf_file(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
return __pyx_pw_3osd_15CoretraceLogger_8elf_file_3__set__(o, v);
}
else {
PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
static PyMethodDef __pyx_methods_3osd_CoretraceLogger[] = {
{"connect", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_5connect, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_4connect},
{"disconnect", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_7disconnect, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_6disconnect},
{"is_connected", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_9is_connected, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_8is_connected},
{"stop", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_11stop, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_10stop},
{"start", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_13start, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_12start},
{"__reduce_cython__", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_15__reduce_cython__, METH_NOARGS, __pyx_doc_3osd_15CoretraceLogger_14__reduce_cython__},
{"__setstate_cython__", (PyCFunction)__pyx_pw_3osd_15CoretraceLogger_17__setstate_cython__, METH_O, __pyx_doc_3osd_15CoretraceLogger_16__setstate_cython__},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_3osd_CoretraceLogger[] = {
{(char *)"log_file", __pyx_getprop_3osd_15CoretraceLogger_log_file, __pyx_setprop_3osd_15CoretraceLogger_log_file, (char *)0, 0},
{(char *)"elf_file", __pyx_getprop_3osd_15CoretraceLogger_elf_file, __pyx_setprop_3osd_15CoretraceLogger_elf_file, (char *)0, 0},
{0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_type_3osd_CoretraceLogger = {
PyVarObject_HEAD_INIT(0, 0)
"osd.CoretraceLogger", /*tp_name*/
sizeof(struct __pyx_obj_3osd_CoretraceLogger), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_3osd_CoretraceLogger, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#endif
#if PY_MAJOR_VERSION >= 3
0, /*tp_as_async*/
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_3osd_CoretraceLogger, /*tp_traverse*/
__pyx_tp_clear_3osd_CoretraceLogger, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_3osd_CoretraceLogger, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_3osd_CoretraceLogger, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_3osd_CoretraceLogger, /*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*/
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
};
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_osd(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
{Py_mod_create, (void*)__pyx_pymod_create},
{Py_mod_exec, (void*)__pyx_pymod_exec_osd},
{0, NULL}
};
#endif
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
"osd",
0, /* m_doc */
#if CYTHON_PEP489_MULTI_PHASE_INIT
0, /* m_size */
#else
-1, /* m_size */
#endif
__pyx_methods /* m_methods */,
#if CYTHON_PEP489_MULTI_PHASE_INIT
__pyx_moduledef_slots, /* m_slots */
#else
NULL, /* m_reload */
#endif
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
#define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define CYTHON_SMALL_CODE __attribute__((cold))
#else
#define CYTHON_SMALL_CODE
#endif
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
{&__pyx_kp_u_1f, __pyx_k_1f, sizeof(__pyx_k_1f), 0, 1, 0, 0},
{&__pyx_kp_u_3_1f, __pyx_k_3_1f, sizeof(__pyx_k_3_1f), 0, 1, 0, 0},
{&__pyx_n_u_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 1, 0, 1},
{&__pyx_n_s_CLOCK_MONOTONIC, __pyx_k_CLOCK_MONOTONIC, sizeof(__pyx_k_CLOCK_MONOTONIC), 0, 0, 1, 1},
{&__pyx_n_s_CRITICAL, __pyx_k_CRITICAL, sizeof(__pyx_k_CRITICAL), 0, 0, 1, 1},
{&__pyx_n_s_CoretraceLogger, __pyx_k_CoretraceLogger, sizeof(__pyx_k_CoretraceLogger), 0, 0, 1, 1},
{&__pyx_n_s_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1},
{&__pyx_n_s_ERROR, __pyx_k_ERROR, sizeof(__pyx_k_ERROR), 0, 0, 1, 1},
{&__pyx_n_u_Ei, __pyx_k_Ei, sizeof(__pyx_k_Ei), 0, 1, 0, 1},
{&__pyx_n_s_GatewayGlip, __pyx_k_GatewayGlip, sizeof(__pyx_k_GatewayGlip), 0, 0, 1, 1},
{&__pyx_n_u_Gi, __pyx_k_Gi, sizeof(__pyx_k_Gi), 0, 1, 0, 1},
{&__pyx_n_s_Hostctrl, __pyx_k_Hostctrl, sizeof(__pyx_k_Hostctrl), 0, 0, 1, 1},
{&__pyx_n_s_Hostmod, __pyx_k_Hostmod, sizeof(__pyx_k_Hostmod), 0, 0, 1, 1},
{&__pyx_n_s_INFO, __pyx_k_INFO, sizeof(__pyx_k_INFO), 0, 0, 1, 1},
{&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
{&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
{&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
{&__pyx_n_u_Ki, __pyx_k_Ki, sizeof(__pyx_k_Ki), 0, 1, 0, 1},
{&__pyx_n_s_Log, __pyx_k_Log, sizeof(__pyx_k_Log), 0, 0, 1, 1},
{&__pyx_n_s_LogRecord, __pyx_k_LogRecord, sizeof(__pyx_k_LogRecord), 0, 0, 1, 1},
{&__pyx_n_s_MemoryAccess, __pyx_k_MemoryAccess, sizeof(__pyx_k_MemoryAccess), 0, 0, 1, 1},
{&__pyx_n_s_MemoryDescriptor, __pyx_k_MemoryDescriptor, sizeof(__pyx_k_MemoryDescriptor), 0, 0, 1, 1},
{&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
{&__pyx_kp_u_Memory_connected_to_MAM_module_a, __pyx_k_Memory_connected_to_MAM_module_a, sizeof(__pyx_k_Memory_connected_to_MAM_module_a), 0, 1, 0, 0},
{&__pyx_kp_u_Memory_read_failed_d, __pyx_k_Memory_read_failed_d, sizeof(__pyx_k_Memory_read_failed_d), 0, 1, 0, 0},
{&__pyx_kp_u_Memory_write_failed_d, __pyx_k_Memory_write_failed_d, sizeof(__pyx_k_Memory_write_failed_d), 0, 1, 0, 0},
{&__pyx_n_u_Mi, __pyx_k_Mi, sizeof(__pyx_k_Mi), 0, 1, 0, 1},
{&__pyx_n_s_Module, __pyx_k_Module, sizeof(__pyx_k_Module), 0, 0, 1, 1},
{&__pyx_n_s_MutableSequence, __pyx_k_MutableSequence, sizeof(__pyx_k_MutableSequence), 0, 0, 1, 1},
{&__pyx_n_s_NOTSET, __pyx_k_NOTSET, sizeof(__pyx_k_NOTSET), 0, 0, 1, 1},
{&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0},
{&__pyx_n_s_OsdErrorException, __pyx_k_OsdErrorException, sizeof(__pyx_k_OsdErrorException), 0, 0, 1, 1},
{&__pyx_n_s_PACKET_HEADER_WORD_CNT, __pyx_k_PACKET_HEADER_WORD_CNT, sizeof(__pyx_k_PACKET_HEADER_WORD_CNT), 0, 0, 1, 1},
{&__pyx_n_s_Packet, __pyx_k_Packet, sizeof(__pyx_k_Packet), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView, __pyx_k_PacketPayloadView, sizeof(__pyx_k_PacketPayloadView), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView___delitem, __pyx_k_PacketPayloadView___delitem, sizeof(__pyx_k_PacketPayloadView___delitem), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView___getitem, __pyx_k_PacketPayloadView___getitem, sizeof(__pyx_k_PacketPayloadView___getitem), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView___init, __pyx_k_PacketPayloadView___init, sizeof(__pyx_k_PacketPayloadView___init), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView___len, __pyx_k_PacketPayloadView___len, sizeof(__pyx_k_PacketPayloadView___len), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView___setitem, __pyx_k_PacketPayloadView___setitem, sizeof(__pyx_k_PacketPayloadView___setitem), 0, 0, 1, 1},
{&__pyx_n_s_PacketPayloadView_insert, __pyx_k_PacketPayloadView_insert, sizeof(__pyx_k_PacketPayloadView_insert), 0, 0, 1, 1},
{&__pyx_n_s_PacketType, __pyx_k_PacketType, sizeof(__pyx_k_PacketType), 0, 0, 1, 1},
{&__pyx_kp_u_Packet_must_have_at_least_3_head, __pyx_k_Packet_must_have_at_least_3_head, sizeof(__pyx_k_Packet_must_have_at_least_3_head), 0, 1, 0, 0},
{&__pyx_n_u_Pi, __pyx_k_Pi, sizeof(__pyx_k_Pi), 0, 1, 0, 1},
{&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
{&__pyx_n_s_SystraceLogger, __pyx_k_SystraceLogger, sizeof(__pyx_k_SystraceLogger), 0, 0, 1, 1},
{&__pyx_n_u_Ti, __pyx_k_Ti, sizeof(__pyx_k_Ti), 0, 1, 0, 1},
{&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
{&__pyx_kp_u_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 1, 0, 0},
{&__pyx_kp_u_Unknown_loglevel, __pyx_k_Unknown_loglevel, sizeof(__pyx_k_Unknown_loglevel), 0, 1, 0, 0},
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
{&__pyx_n_s_WARNING, __pyx_k_WARNING, sizeof(__pyx_k_WARNING), 0, 0, 1, 1},
{&__pyx_kp_u_XXX_Extend_to_support_other_size, __pyx_k_XXX_Extend_to_support_other_size, sizeof(__pyx_k_XXX_Extend_to_support_other_size), 0, 1, 0, 0},
{&__pyx_kp_u_Yi, __pyx_k_Yi, sizeof(__pyx_k_Yi), 0, 1, 0, 0},
{&__pyx_n_u_Zi, __pyx_k_Zi, sizeof(__pyx_k_Zi), 0, 1, 0, 1},
{&__pyx_kp_u__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 1, 0, 0},
{&__pyx_kp_u__21, __pyx_k__21, sizeof(__pyx_k__21), 0, 1, 0, 0},
{&__pyx_kp_u__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 1, 0, 0},
{&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1},
{&__pyx_n_u_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 1, 0, 1},
{&__pyx_n_s_addr_width_bit, __pyx_k_addr_width_bit, sizeof(__pyx_k_addr_width_bit), 0, 0, 1, 1},
{&__pyx_kp_u_address_width, __pyx_k_address_width, sizeof(__pyx_k_address_width), 0, 1, 0, 0},
{&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
{&__pyx_kp_u_base_address_0x, __pyx_k_base_address_0x, sizeof(__pyx_k_base_address_0x), 0, 1, 0, 0},
{&__pyx_n_s_baseaddr, __pyx_k_baseaddr, sizeof(__pyx_k_baseaddr), 0, 0, 1, 1},
{&__pyx_n_u_baseaddr, __pyx_k_baseaddr, sizeof(__pyx_k_baseaddr), 0, 1, 0, 1},
{&__pyx_kp_u_bit, __pyx_k_bit, sizeof(__pyx_k_bit), 0, 1, 0, 0},
{&__pyx_kp_u_bit_data_width, __pyx_k_bit_data_width, sizeof(__pyx_k_bit_data_width), 0, 1, 0, 0},
{&__pyx_n_u_bytes_from_device, __pyx_k_bytes_from_device, sizeof(__pyx_k_bytes_from_device), 0, 1, 0, 1},
{&__pyx_n_u_bytes_to_device, __pyx_k_bytes_to_device, sizeof(__pyx_k_bytes_to_device), 0, 1, 0, 1},
{&__pyx_n_s_c_data, __pyx_k_c_data, sizeof(__pyx_k_c_data), 0, 0, 1, 1},
{&__pyx_n_s_cl_mam_get_mem_desc, __pyx_k_cl_mam_get_mem_desc, sizeof(__pyx_k_cl_mam_get_mem_desc), 0, 0, 1, 1},
{&__pyx_n_s_cl_mam_read, __pyx_k_cl_mam_read, sizeof(__pyx_k_cl_mam_read), 0, 0, 1, 1},
{&__pyx_n_s_cl_mam_write, __pyx_k_cl_mam_write, sizeof(__pyx_k_cl_mam_write), 0, 0, 1, 1},
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
{&__pyx_n_s_clock_gettime, __pyx_k_clock_gettime, sizeof(__pyx_k_clock_gettime), 0, 0, 1, 1},
{&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
{&__pyx_n_u_connected_secs, __pyx_k_connected_secs, sizeof(__pyx_k_connected_secs), 0, 1, 0, 1},
{&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 1},
{&__pyx_kp_u_d_region_s, __pyx_k_d_region_s, sizeof(__pyx_k_d_region_s), 0, 1, 0, 0},
{&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
{&__pyx_n_s_data_width_bit, __pyx_k_data_width_bit, sizeof(__pyx_k_data_width_bit), 0, 0, 1, 1},
{&__pyx_n_s_delitem, __pyx_k_delitem, sizeof(__pyx_k_delitem), 0, 0, 1, 1},
{&__pyx_n_s_dest, __pyx_k_dest, sizeof(__pyx_k_dest), 0, 0, 1, 1},
{&__pyx_n_s_device_subnet_addr, __pyx_k_device_subnet_addr, sizeof(__pyx_k_device_subnet_addr), 0, 0, 1, 1},
{&__pyx_n_s_di_addr, __pyx_k_di_addr, sizeof(__pyx_k_di_addr), 0, 0, 1, 1},
{&__pyx_n_s_diaddr, __pyx_k_diaddr, sizeof(__pyx_k_diaddr), 0, 0, 1, 1},
{&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
{&__pyx_n_s_disconnect, __pyx_k_disconnect, sizeof(__pyx_k_disconnect), 0, 0, 1, 1},
{&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
{&__pyx_n_s_elf_file_path, __pyx_k_elf_file_path, sizeof(__pyx_k_elf_file_path), 0, 0, 1, 1},
{&__pyx_n_s_enabled, __pyx_k_enabled, sizeof(__pyx_k_enabled), 0, 0, 1, 1},
{&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
{&__pyx_n_s_ensure_cself, __pyx_k_ensure_cself, sizeof(__pyx_k_ensure_cself), 0, 0, 1, 1},
{&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
{&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
{&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1},
{&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1},
{&__pyx_n_s_getEffectiveLevel, __pyx_k_getEffectiveLevel, sizeof(__pyx_k_getEffectiveLevel), 0, 0, 1, 1},
{&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
{&__pyx_n_s_get_type_long_name, __pyx_k_get_type_long_name, sizeof(__pyx_k_get_type_long_name), 0, 0, 1, 1},
{&__pyx_n_s_get_type_short_name, __pyx_k_get_type_short_name, sizeof(__pyx_k_get_type_short_name), 0, 0, 1, 1},
{&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
{&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
{&__pyx_n_s_glip_backend_name, __pyx_k_glip_backend_name, sizeof(__pyx_k_glip_backend_name), 0, 0, 1, 1},
{&__pyx_n_s_glip_backend_options, __pyx_k_glip_backend_options, sizeof(__pyx_k_glip_backend_options), 0, 0, 1, 1},
{&__pyx_n_s_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 0, 0, 1, 1},
{&__pyx_n_s_host_controller_address, __pyx_k_host_controller_address, sizeof(__pyx_k_host_controller_address), 0, 0, 1, 1},
{&__pyx_n_s_hostmod, __pyx_k_hostmod, sizeof(__pyx_k_hostmod), 0, 0, 1, 1},
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
{&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
{&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
{&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
{&__pyx_n_s_is_connected, __pyx_k_is_connected, sizeof(__pyx_k_is_connected), 0, 0, 1, 1},
{&__pyx_n_s_is_running, __pyx_k_is_running, sizeof(__pyx_k_is_running), 0, 0, 1, 1},
{&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
{&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
{&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
{&__pyx_n_s_lineno, __pyx_k_lineno, sizeof(__pyx_k_lineno), 0, 0, 1, 1},
{&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
{&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
{&__pyx_n_u_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 1, 0, 1},
{&__pyx_n_s_mam_di_addr, __pyx_k_mam_di_addr, sizeof(__pyx_k_mam_di_addr), 0, 0, 1, 1},
{&__pyx_n_s_mem_desc, __pyx_k_mem_desc, sizeof(__pyx_k_mem_desc), 0, 0, 1, 1},
{&__pyx_n_s_memsize, __pyx_k_memsize, sizeof(__pyx_k_memsize), 0, 0, 1, 1},
{&__pyx_n_u_memsize, __pyx_k_memsize, sizeof(__pyx_k_memsize), 0, 1, 0, 1},
{&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
{&__pyx_n_u_micro, __pyx_k_micro, sizeof(__pyx_k_micro), 0, 1, 0, 1},
{&__pyx_n_u_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 1, 0, 1},
{&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
{&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
{&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
{&__pyx_n_s_nbyte, __pyx_k_nbyte, sizeof(__pyx_k_nbyte), 0, 0, 1, 1},
{&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
{&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
{&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1},
{&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
{&__pyx_n_s_osd, __pyx_k_osd, sizeof(__pyx_k_osd), 0, 0, 1, 1},
{&__pyx_n_s_osd_library_version, __pyx_k_osd_library_version, sizeof(__pyx_k_osd_library_version), 0, 0, 1, 1},
{&__pyx_n_s_packet, __pyx_k_packet, sizeof(__pyx_k_packet), 0, 0, 1, 1},
{&__pyx_n_s_pathname, __pyx_k_pathname, sizeof(__pyx_k_pathname), 0, 0, 1, 1},
{&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
{&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
{&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
{&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
{&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
{&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
{&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
{&__pyx_n_s_pyx_unpickle_Module, __pyx_k_pyx_unpickle_Module, sizeof(__pyx_k_pyx_unpickle_Module), 0, 0, 1, 1},
{&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 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_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
{&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
{&__pyx_n_s_reg_addr, __pyx_k_reg_addr, sizeof(__pyx_k_reg_addr), 0, 0, 1, 1},
{&__pyx_n_s_reg_size_bit, __pyx_k_reg_size_bit, sizeof(__pyx_k_reg_size_bit), 0, 0, 1, 1},
{&__pyx_n_s_regions, __pyx_k_regions, sizeof(__pyx_k_regions), 0, 0, 1, 1},
{&__pyx_n_s_router_address, __pyx_k_router_address, sizeof(__pyx_k_router_address), 0, 0, 1, 1},
{&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1},
{&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
{&__pyx_kp_s_self__cself_cannot_be_converted, __pyx_k_self__cself_cannot_be_converted, sizeof(__pyx_k_self__cself_cannot_be_converted), 0, 0, 1, 0},
{&__pyx_n_s_setitem, __pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 0, 1, 1},
{&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
{&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
{&__pyx_kp_u_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 1, 0, 0},
{&__pyx_n_s_sizeof_fmt, __pyx_k_sizeof_fmt, sizeof(__pyx_k_sizeof_fmt), 0, 0, 1, 1},
{&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1},
{&__pyx_kp_s_src_osd_pyx, __pyx_k_src_osd_pyx, sizeof(__pyx_k_src_osd_pyx), 0, 0, 1, 0},
{&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
{&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
{&__pyx_n_s_str___locals_sizeof_fmt, __pyx_k_str___locals_sizeof_fmt, sizeof(__pyx_k_str___locals_sizeof_fmt), 0, 0, 1, 1},
{&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
{&__pyx_n_s_suffix, __pyx_k_suffix, sizeof(__pyx_k_suffix), 0, 0, 1, 1},
{&__pyx_n_u_suffix, __pyx_k_suffix, sizeof(__pyx_k_suffix), 0, 1, 0, 1},
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
{&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
{&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
{&__pyx_n_u_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 1, 0, 1},
{&__pyx_n_s_type_id, __pyx_k_type_id, sizeof(__pyx_k_type_id), 0, 0, 1, 1},
{&__pyx_n_s_type_sub, __pyx_k_type_sub, sizeof(__pyx_k_type_sub), 0, 0, 1, 1},
{&__pyx_n_s_unit, __pyx_k_unit, sizeof(__pyx_k_unit), 0, 0, 1, 1},
{&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
{&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
{&__pyx_n_u_vendor, __pyx_k_vendor, sizeof(__pyx_k_vendor), 0, 1, 0, 1},
{&__pyx_n_s_vendor_id, __pyx_k_vendor_id, sizeof(__pyx_k_vendor_id), 0, 0, 1, 1},
{&__pyx_n_s_verify, __pyx_k_verify, sizeof(__pyx_k_verify), 0, 0, 1, 1},
{&__pyx_n_s_vers, __pyx_k_vers, sizeof(__pyx_k_vers), 0, 0, 1, 1},
{&__pyx_n_u_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 1, 0, 1},
{&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
{&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 543, __pyx_L1_error)
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 180, __pyx_L1_error)
__pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
__pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 244, __pyx_L1_error)
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 255, __pyx_L1_error)
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 391, __pyx_L1_error)
__pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 764, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
}
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__2);
__Pyx_GIVEREF(__pyx_tuple__2);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
__pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self__cself_cannot_be_converted); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__4);
__Pyx_GIVEREF(__pyx_tuple__4);
/* "(tree fragment)":4
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
*/
__pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self__cself_cannot_be_converted); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__5);
__Pyx_GIVEREF(__pyx_tuple__5);
/* "osd.pyx":255
* def __delitem__(self, index):
* if len(self) <= 3:
* raise ValueError("Packet must have at least 3 (header) words.") # <<<<<<<<<<<<<<
*
* memmove(&self._cself.data_raw[index], &self._cself.data_raw[index + 1],
*/
__pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Packet_must_have_at_least_3_head); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__6);
__Pyx_GIVEREF(__pyx_tuple__6);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
*/
__pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_self__cself_cannot_be_converted); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__7);
__Pyx_GIVEREF(__pyx_tuple__7);
/* "(tree fragment)":4
* raise TypeError("self._cself cannot be converted to a Python object for pickling")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("self._cself cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
*/
__pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_self__cself_cannot_be_converted); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__8);
__Pyx_GIVEREF(__pyx_tuple__8);
/* "osd.pyx":364
* cdef uint16_t outvalue
* if reg_size_bit != 16:
* raise Exception("XXX: Extend to support other sizes than 16 bit registers") # <<<<<<<<<<<<<<
*
* rv = cosd.osd_hostmod_reg_read(self._cself, &outvalue, diaddr, reg_addr,
*/
__pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_XXX_Extend_to_support_other_size); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__9);
__Pyx_GIVEREF(__pyx_tuple__9);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__10);
__Pyx_GIVEREF(__pyx_tuple__10);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__11);
__Pyx_GIVEREF(__pyx_tuple__11);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__12);
__Pyx_GIVEREF(__pyx_tuple__12);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__13);
__Pyx_GIVEREF(__pyx_tuple__13);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__14);
__Pyx_GIVEREF(__pyx_tuple__14);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__15);
__Pyx_GIVEREF(__pyx_tuple__15);
/* "osd.pyx":579
* def __str__(self):
* def sizeof_fmt(num, suffix='B'):
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: # <<<<<<<<<<<<<<
* if abs(num) < 1024.0:
* return "%3.1f %s%s" % (num, unit, suffix)
*/
__pyx_tuple__16 = PyTuple_Pack(8, __pyx_kp_u_, __pyx_n_u_Ki, __pyx_n_u_Mi, __pyx_n_u_Gi, __pyx_n_u_Ti, __pyx_n_u_Pi, __pyx_n_u_Ei, __pyx_n_u_Zi); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__16);
__Pyx_GIVEREF(__pyx_tuple__16);
/* "osd.pyx":578
*
* def __str__(self):
* def sizeof_fmt(num, suffix='B'): # <<<<<<<<<<<<<<
* for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
* if abs(num) < 1024.0:
*/
__pyx_tuple__18 = PyTuple_Pack(3, __pyx_n_s_num, __pyx_n_s_suffix, __pyx_n_s_unit); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 578, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__18);
__Pyx_GIVEREF(__pyx_tuple__18);
__pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_sizeof_fmt, 578, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 578, __pyx_L1_error)
__pyx_tuple__20 = PyTuple_Pack(1, ((PyObject*)__pyx_n_u_B)); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 578, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__20);
__Pyx_GIVEREF(__pyx_tuple__20);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__23);
__Pyx_GIVEREF(__pyx_tuple__23);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__24);
__Pyx_GIVEREF(__pyx_tuple__24);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__25);
__Pyx_GIVEREF(__pyx_tuple__25);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__26);
__Pyx_GIVEREF(__pyx_tuple__26);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__27);
__Pyx_GIVEREF(__pyx_tuple__27);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__28);
__Pyx_GIVEREF(__pyx_tuple__28);
/* "(tree fragment)":2
* def __reduce_cython__(self):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
*/
__pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 2, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__29);
__Pyx_GIVEREF(__pyx_tuple__29);
/* "(tree fragment)":4
* raise TypeError("no default __reduce__ due to non-trivial __cinit__")
* def __setstate_cython__(self, __pyx_state):
* raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
*/
__pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__30);
__Pyx_GIVEREF(__pyx_tuple__30);
/* "osd.pyx":32
*
*
* def osd_library_version(): # <<<<<<<<<<<<<<
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {}
*/
__pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_vers, __pyx_n_s_version_info); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__31);
__Pyx_GIVEREF(__pyx_tuple__31);
__pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_osd_library_version, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 32, __pyx_L1_error)
/* "osd.pyx":191
* PACKET_HEADER_WORD_CNT = 3
*
* def __init__(self, packet): # <<<<<<<<<<<<<<
* self.packet = packet
*
*/
__pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_packet); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 191, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__33);
__Pyx_GIVEREF(__pyx_tuple__33);
__pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_init, 191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 191, __pyx_L1_error)
/* "osd.pyx":194
* self.packet = packet
*
* def __len__(self): # <<<<<<<<<<<<<<
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
*/
__pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 194, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__35);
__Pyx_GIVEREF(__pyx_tuple__35);
__pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_len, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 194, __pyx_L1_error)
/* "osd.pyx":197
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
__pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_index); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__37);
__Pyx_GIVEREF(__pyx_tuple__37);
__pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_getitem, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 197, __pyx_L1_error)
/* "osd.pyx":200
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
*/
__pyx_tuple__39 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_value); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__39);
__Pyx_GIVEREF(__pyx_tuple__39);
__pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_setitem, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 200, __pyx_L1_error)
/* "osd.pyx":203
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
__pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_index); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 203, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__41);
__Pyx_GIVEREF(__pyx_tuple__41);
__pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_delitem, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 203, __pyx_L1_error)
/* "osd.pyx":206
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
*/
__pyx_tuple__43 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_value); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__43);
__Pyx_GIVEREF(__pyx_tuple__43);
__pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_insert, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 206, __pyx_L1_error)
/* "osd.pyx":544
* cdef class Module:
* @staticmethod
* def get_type_short_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*
*/
__pyx_tuple__45 = PyTuple_Pack(2, __pyx_n_s_vendor_id, __pyx_n_s_type_id); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 544, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__45);
__Pyx_GIVEREF(__pyx_tuple__45);
__pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_get_type_short_name, 544, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 544, __pyx_L1_error)
/* "osd.pyx":548
*
* @staticmethod
* def get_type_long_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id))
*
*/
__pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_vendor_id, __pyx_n_s_type_id); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 548, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__47);
__Pyx_GIVEREF(__pyx_tuple__47);
__pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_get_type_long_name, 548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 548, __pyx_L1_error)
/* "osd.pyx":600
* return str
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr): # <<<<<<<<<<<<<<
* mem_desc = MemoryDescriptor()
*
*/
__pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_hostmod, __pyx_n_s_mam_di_addr, __pyx_n_s_mem_desc); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 600, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__49);
__Pyx_GIVEREF(__pyx_tuple__49);
__pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_cl_mam_get_mem_desc, 600, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 600, __pyx_L1_error)
/* "osd.pyx":607
* return mem_desc
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr): # <<<<<<<<<<<<<<
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
*/
__pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_s_mem_desc, __pyx_n_s_hostmod, __pyx_n_s_data, __pyx_n_s_addr, __pyx_n_s_c_data, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__51);
__Pyx_GIVEREF(__pyx_tuple__51);
__pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_cl_mam_write, 607, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 607, __pyx_L1_error)
/* "osd.pyx":614
* raise Exception("Memory write failed (%d)" % rv)
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte): # <<<<<<<<<<<<<<
* data = bytearray(nbyte)
* cdef char* c_data = data
*/
__pyx_tuple__53 = PyTuple_Pack(7, __pyx_n_s_mem_desc, __pyx_n_s_hostmod, __pyx_n_s_addr, __pyx_n_s_nbyte, __pyx_n_s_data, __pyx_n_s_c_data, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 614, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__53);
__Pyx_GIVEREF(__pyx_tuple__53);
__pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_osd_pyx, __pyx_n_s_cl_mam_read, 614, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 614, __pyx_L1_error)
/* "(tree fragment)":1
* def __pyx_unpickle_Module(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
* cdef object __pyx_PickleError
* cdef object __pyx_result
*/
__pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 1, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__55);
__Pyx_GIVEREF(__pyx_tuple__55);
__pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Module, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 1, __pyx_L1_error)
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
__pyx_float_1024_0 = PyFloat_FromDouble(1024.0); if (unlikely(!__pyx_float_1024_0)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
}
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
static int __Pyx_modinit_global_init_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
/*--- Global init code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_modinit_variable_export_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
/*--- Variable export code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_modinit_function_export_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
/*--- Function export code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_modinit_type_init_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
/*--- Type init code ---*/
if (PyType_Ready(&__pyx_type_3osd_Log) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_Log.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_Log.tp_dictoffset && __pyx_type_3osd_Log.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_Log.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Log, (PyObject *)&__pyx_type_3osd_Log) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_Log) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
__pyx_ptype_3osd_Log = &__pyx_type_3osd_Log;
if (PyType_Ready(&__pyx_type_3osd_PacketType) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_PacketType.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_PacketType.tp_dictoffset && __pyx_type_3osd_PacketType.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_PacketType.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PacketType, (PyObject *)&__pyx_type_3osd_PacketType) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_PacketType) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
__pyx_ptype_3osd_PacketType = &__pyx_type_3osd_PacketType;
if (PyType_Ready(&__pyx_type_3osd_Hostmod) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_Hostmod.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_Hostmod.tp_dictoffset && __pyx_type_3osd_Hostmod.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_Hostmod.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Hostmod, (PyObject *)&__pyx_type_3osd_Hostmod) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_Hostmod) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
__pyx_ptype_3osd_Hostmod = &__pyx_type_3osd_Hostmod;
if (PyType_Ready(&__pyx_type_3osd_GatewayGlip) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_GatewayGlip.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_GatewayGlip.tp_dictoffset && __pyx_type_3osd_GatewayGlip.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_GatewayGlip.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_GatewayGlip, (PyObject *)&__pyx_type_3osd_GatewayGlip) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_GatewayGlip) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
__pyx_ptype_3osd_GatewayGlip = &__pyx_type_3osd_GatewayGlip;
if (PyType_Ready(&__pyx_type_3osd_Hostctrl) < 0) __PYX_ERR(0, 513, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_Hostctrl.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_Hostctrl.tp_dictoffset && __pyx_type_3osd_Hostctrl.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_Hostctrl.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Hostctrl, (PyObject *)&__pyx_type_3osd_Hostctrl) < 0) __PYX_ERR(0, 513, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_Hostctrl) < 0) __PYX_ERR(0, 513, __pyx_L1_error)
__pyx_ptype_3osd_Hostctrl = &__pyx_type_3osd_Hostctrl;
if (PyType_Ready(&__pyx_type_3osd_Module) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_Module.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_Module.tp_dictoffset && __pyx_type_3osd_Module.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_Module.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Module, (PyObject *)&__pyx_type_3osd_Module) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_Module) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
__pyx_ptype_3osd_Module = &__pyx_type_3osd_Module;
if (PyType_Ready(&__pyx_type_3osd_MemoryDescriptor) < 0) __PYX_ERR(0, 552, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_MemoryDescriptor.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_MemoryDescriptor.tp_dictoffset && __pyx_type_3osd_MemoryDescriptor.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_MemoryDescriptor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MemoryDescriptor, (PyObject *)&__pyx_type_3osd_MemoryDescriptor) < 0) __PYX_ERR(0, 552, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_MemoryDescriptor) < 0) __PYX_ERR(0, 552, __pyx_L1_error)
__pyx_ptype_3osd_MemoryDescriptor = &__pyx_type_3osd_MemoryDescriptor;
if (PyType_Ready(&__pyx_type_3osd_MemoryAccess) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_MemoryAccess.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_MemoryAccess.tp_dictoffset && __pyx_type_3osd_MemoryAccess.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_MemoryAccess.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MemoryAccess, (PyObject *)&__pyx_type_3osd_MemoryAccess) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_MemoryAccess) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
__pyx_ptype_3osd_MemoryAccess = &__pyx_type_3osd_MemoryAccess;
if (PyType_Ready(&__pyx_type_3osd_SystraceLogger) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_SystraceLogger.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_SystraceLogger.tp_dictoffset && __pyx_type_3osd_SystraceLogger.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_SystraceLogger.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SystraceLogger, (PyObject *)&__pyx_type_3osd_SystraceLogger) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_SystraceLogger) < 0) __PYX_ERR(0, 695, __pyx_L1_error)
__pyx_ptype_3osd_SystraceLogger = &__pyx_type_3osd_SystraceLogger;
if (PyType_Ready(&__pyx_type_3osd_CoretraceLogger) < 0) __PYX_ERR(0, 790, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_CoretraceLogger.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_CoretraceLogger.tp_dictoffset && __pyx_type_3osd_CoretraceLogger.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_CoretraceLogger.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CoretraceLogger, (PyObject *)&__pyx_type_3osd_CoretraceLogger) < 0) __PYX_ERR(0, 790, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_CoretraceLogger) < 0) __PYX_ERR(0, 790, __pyx_L1_error)
__pyx_ptype_3osd_CoretraceLogger = &__pyx_type_3osd_CoretraceLogger;
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_modinit_type_import_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
/*--- Type import code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_modinit_variable_import_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
/*--- Variable import code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_modinit_function_import_code(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
/*--- Function import code ---*/
__Pyx_RefNannyFinishContext();
return 0;
}
#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif
#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initosd(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initosd(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_osd(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_osd(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
#if PY_VERSION_HEX >= 0x030700A1
static PY_INT64_T main_interpreter_id = -1;
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
if (main_interpreter_id == -1) {
main_interpreter_id = current_id;
return (unlikely(current_id == -1)) ? -1 : 0;
} else if (unlikely(main_interpreter_id != current_id))
#else
static PyInterpreterState *main_interpreter = NULL;
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
if (!main_interpreter) {
main_interpreter = current_interpreter;
} else if (unlikely(main_interpreter != current_interpreter))
#endif
{
PyErr_SetString(
PyExc_ImportError,
"Interpreter change detected - this module can only be loaded into one interpreter per process.");
return -1;
}
return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
PyObject *value = PyObject_GetAttrString(spec, from_name);
int result = 0;
if (likely(value)) {
if (allow_none || value != Py_None) {
result = PyDict_SetItemString(moddict, to_name, value);
}
Py_DECREF(value);
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Clear();
} else {
result = -1;
}
return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
PyObject *module = NULL, *moddict, *modname;
if (__Pyx_check_single_interpreter())
return NULL;
if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
modname = PyObject_GetAttrString(spec, "name");
if (unlikely(!modname)) goto bad;
module = PyModule_NewObject(modname);
Py_DECREF(modname);
if (unlikely(!module)) goto bad;
moddict = PyModule_GetDict(module);
if (unlikely(!moddict)) goto bad;
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
return module;
bad:
Py_XDECREF(module);
return NULL;
}
static CYTHON_SMALL_CODE int __pyx_pymod_exec_osd(PyObject *__pyx_pyinit_module)
#endif
#endif
{
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_PEP489_MULTI_PHASE_INIT
if (__pyx_m) {
if (__pyx_m == __pyx_pyinit_module) return 0;
PyErr_SetString(PyExc_RuntimeError, "Module 'osd' has already been imported. Re-initialisation is not supported.");
return -1;
}
#elif PY_MAJOR_VERSION >= 3
if (__pyx_m) return __Pyx_NewRef(__pyx_m);
#endif
#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("__Pyx_PyMODINIT_FUNC PyInit_osd(void)", 0);
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#ifdef __Pxy_PyFrame_Initialize_Offsets
__Pxy_PyFrame_Initialize_Offsets();
#endif
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
#ifdef __Pyx_CyFunction_USED
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
#ifdef __Pyx_Coroutine_USED
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
#ifdef __Pyx_AsyncGen_USED
if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
#ifdef __Pyx_StopAsyncIteration_USED
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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 CYTHON_PEP489_MULTI_PHASE_INIT
__pyx_m = __pyx_pyinit_module;
Py_INCREF(__pyx_m);
#else
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4("osd", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
Py_INCREF(__pyx_d);
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
Py_INCREF(__pyx_b);
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
Py_INCREF(__pyx_cython_runtime);
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
/*--- Initialize various global constants etc. ---*/
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
if (__pyx_module_is_main_osd) {
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
}
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
if (!PyDict_GetItemString(modules, "osd")) {
if (unlikely(PyDict_SetItemString(modules, "osd", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
}
}
#endif
/*--- Builtin init code ---*/
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
/*--- Constants init code ---*/
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
/*--- Global type/function init code ---*/
(void)__Pyx_modinit_global_init_code();
(void)__Pyx_modinit_variable_export_code();
(void)__Pyx_modinit_function_export_code();
if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
(void)__Pyx_modinit_type_import_code();
(void)__Pyx_modinit_variable_import_code();
(void)__Pyx_modinit_function_import_code();
/*--- Execution code ---*/
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
#endif
/* "osd.pyx":26
* from posix.time cimport timespec
*
* import logging # <<<<<<<<<<<<<<
* import os
* import time
*/
__pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":27
*
* import logging
* import os # <<<<<<<<<<<<<<
* import time
* from collections.abc import MutableSequence
*/
__pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":28
* import logging
* import os
* import time # <<<<<<<<<<<<<<
* from collections.abc import MutableSequence
*
*/
__pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":29
* import os
* import time
* from collections.abc import MutableSequence # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_n_s_MutableSequence);
__Pyx_GIVEREF(__pyx_n_s_MutableSequence);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MutableSequence);
__pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MutableSequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_MutableSequence, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":32
*
*
* def osd_library_version(): # <<<<<<<<<<<<<<
* cdef const cosd.osd_version* vers = cosd.osd_version_get()
* version_info = {}
*/
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3osd_1osd_library_version, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_osd_library_version, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "osd.pyx":162
*
*
* class OsdErrorException(Exception): # <<<<<<<<<<<<<<
* pass
*
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
__Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
__pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_OsdErrorException, __pyx_n_s_OsdErrorException, (PyObject *) NULL, __pyx_n_s_osd, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_OsdErrorException, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_OsdErrorException, __pyx_t_4) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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;
/* "osd.pyx":186
* cosd.osd_log_free(&self._cself)
*
* class PacketPayloadView(MutableSequence): # <<<<<<<<<<<<<<
* # Keep this constant in sync with packet.c. (Or read it at runtime, which we
* # avoid here for performance reasons.)
*/
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MutableSequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_PacketPayloadView, __pyx_n_s_PacketPayloadView, (PyObject *) NULL, __pyx_n_s_osd, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
/* "osd.pyx":189
* # Keep this constant in sync with packet.c. (Or read it at runtime, which we
* # avoid here for performance reasons.)
* PACKET_HEADER_WORD_CNT = 3 # <<<<<<<<<<<<<<
*
* def __init__(self, packet):
*/
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_PACKET_HEADER_WORD_CNT, __pyx_int_3) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
/* "osd.pyx":191
* PACKET_HEADER_WORD_CNT = 3
*
* def __init__(self, packet): # <<<<<<<<<<<<<<
* self.packet = packet
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_1__init__, 0, __pyx_n_s_PacketPayloadView___init, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 191, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":194
* self.packet = packet
*
* def __len__(self): # <<<<<<<<<<<<<<
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_3__len__, 0, __pyx_n_s_PacketPayloadView___len, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_len, __pyx_t_4) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":197
* return len(self.packet) - self.PACKET_HEADER_WORD_CNT
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_5__getitem__, 0, __pyx_n_s_PacketPayloadView___getitem, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_getitem, __pyx_t_4) < 0) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":200
* return self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def __setitem__(self, index, value): # <<<<<<<<<<<<<<
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_7__setitem__, 0, __pyx_n_s_PacketPayloadView___setitem, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_setitem, __pyx_t_4) < 0) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":203
* self.packet[index + self.PACKET_HEADER_WORD_CNT] = value
*
* def __delitem__(self, index): # <<<<<<<<<<<<<<
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_9__delitem__, 0, __pyx_n_s_PacketPayloadView___delitem, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_delitem, __pyx_t_4) < 0) __PYX_ERR(0, 203, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":206
* del self.packet[index + self.PACKET_HEADER_WORD_CNT]
*
* def insert(self, index, value): # <<<<<<<<<<<<<<
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
*/
__pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3osd_17PacketPayloadView_11insert, 0, __pyx_n_s_PacketPayloadView_insert, NULL, __pyx_n_s_osd, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_insert, __pyx_t_4) < 0) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "osd.pyx":186
* cosd.osd_log_free(&self._cself)
*
* class PacketPayloadView(MutableSequence): # <<<<<<<<<<<<<<
* # Keep this constant in sync with packet.c. (Or read it at runtime, which we
* # avoid here for performance reasons.)
*/
__pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_PacketPayloadView, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_PacketPayloadView, __pyx_t_4) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "osd.pyx":209
* self.packet.insert(index + self.PACKET_HEADER_WORD_CNT, value)
*
* cdef class Packet(PacketType, MutableSequence): # <<<<<<<<<<<<<<
* pass
*
*/
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MutableSequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_ptype_3osd_PacketType));
__Pyx_GIVEREF(((PyObject *)__pyx_ptype_3osd_PacketType));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_3osd_PacketType));
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_n_s_Packet);
__Pyx_GIVEREF(__pyx_n_s_Packet);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Packet);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
__pyx_t_2 = 0;
__pyx_t_1 = 0;
__pyx_t_1 = PyType_Type.tp_new(&PyType_Type, __pyx_t_3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (((PyTypeObject*) __pyx_t_1)->tp_base != ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))) {
PyErr_Format(PyExc_TypeError, "best base '%s' must be equal to first base '%s'",
((PyTypeObject*) __pyx_t_1)->tp_base->tp_name, ((PyTypeObject*)PyTuple_GET_ITEM(PyTuple_GET_ITEM(__pyx_t_3, 1), 0))->tp_name);
__PYX_ERR(0, 209, __pyx_L1_error)
}
__Pyx_INCREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
__Pyx_GIVEREF(PyTuple_GET_ITEM(__pyx_t_3, 1));
__pyx_type_3osd_Packet.tp_bases = PyTuple_GET_ITEM(__pyx_t_3, 1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_type_3osd_Packet.tp_base = __pyx_ptype_3osd_PacketType;
if (__Pyx_PyType_Ready(&__pyx_type_3osd_Packet) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
#if PY_VERSION_HEX < 0x030800B1
__pyx_type_3osd_Packet.tp_print = 0;
#endif
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_3osd_Packet.tp_dictoffset && __pyx_type_3osd_Packet.tp_getattro == PyObject_GenericGetAttr)) {
__pyx_type_3osd_Packet.tp_getattro = __Pyx_PyObject_GenericGetAttr;
}
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Packet, (PyObject *)&__pyx_type_3osd_Packet) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
if (__Pyx_setup_reduce((PyObject*)&__pyx_type_3osd_Packet) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
__pyx_ptype_3osd_Packet = &__pyx_type_3osd_Packet;
/* "osd.pyx":544
* cdef class Module:
* @staticmethod
* def get_type_short_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3osd_6Module_1get_type_short_name, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem((PyObject *)__pyx_ptype_3osd_Module->tp_dict, __pyx_n_s_get_type_short_name, __pyx_t_3) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
PyType_Modified(__pyx_ptype_3osd_Module);
/* "osd.pyx":543
*
* cdef class Module:
* @staticmethod # <<<<<<<<<<<<<<
* def get_type_short_name(vendor_id, type_id):
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*/
__Pyx_GetNameInClass(__pyx_t_3, (PyObject *)__pyx_ptype_3osd_Module, __pyx_n_s_get_type_short_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (PyDict_SetItem((PyObject *)__pyx_ptype_3osd_Module->tp_dict, __pyx_n_s_get_type_short_name, __pyx_t_1) < 0) __PYX_ERR(0, 544, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_ptype_3osd_Module);
/* "osd.pyx":548
*
* @staticmethod
* def get_type_long_name(vendor_id, type_id): # <<<<<<<<<<<<<<
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id))
*
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3osd_6Module_3get_type_long_name, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem((PyObject *)__pyx_ptype_3osd_Module->tp_dict, __pyx_n_s_get_type_long_name, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_ptype_3osd_Module);
/* "osd.pyx":547
* return str(cosd.osd_module_get_type_short_name(vendor_id, type_id))
*
* @staticmethod # <<<<<<<<<<<<<<
* def get_type_long_name(vendor_id, type_id):
* return str(cosd.osd_module_get_type_long_name(vendor_id, type_id))
*/
__Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_3osd_Module, __pyx_n_s_get_type_long_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyDict_SetItem((PyObject *)__pyx_ptype_3osd_Module->tp_dict, __pyx_n_s_get_type_long_name, __pyx_t_3) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
PyType_Modified(__pyx_ptype_3osd_Module);
/* "osd.pyx":600
* return str
*
* def cl_mam_get_mem_desc(Hostmod hostmod, mam_di_addr): # <<<<<<<<<<<<<<
* mem_desc = MemoryDescriptor()
*
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3osd_3cl_mam_get_mem_desc, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_cl_mam_get_mem_desc, __pyx_t_3) < 0) __PYX_ERR(0, 600, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":607
* return mem_desc
*
* def cl_mam_write(MemoryDescriptor mem_desc, Hostmod hostmod, data, addr): # <<<<<<<<<<<<<<
* cdef char* c_data = data
* rv = cosd.osd_cl_mam_write(&mem_desc._cself, hostmod._cself, c_data,
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3osd_5cl_mam_write, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_cl_mam_write, __pyx_t_3) < 0) __PYX_ERR(0, 607, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":614
* raise Exception("Memory write failed (%d)" % rv)
*
* def cl_mam_read(MemoryDescriptor mem_desc, Hostmod hostmod, addr, nbyte): # <<<<<<<<<<<<<<
* data = bytearray(nbyte)
* cdef char* c_data = data
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3osd_7cl_mam_read, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_cl_mam_read, __pyx_t_3) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "(tree fragment)":1
* def __pyx_unpickle_Module(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
* cdef object __pyx_PickleError
* cdef object __pyx_result
*/
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_3osd_9__pyx_unpickle_Module, NULL, __pyx_n_s_osd); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Module, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "osd.pyx":1
* # Copyright 2017-2019 The Open SoC Debug Project # <<<<<<<<<<<<<<
* #
* # Licensed under the Apache License, Version 2.0 (the "License");
*/
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/*--- Wrapped vars code ---*/
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_4);
if (__pyx_m) {
if (__pyx_d) {
__Pyx_AddTraceback("init osd", __pyx_clineno, __pyx_lineno, __pyx_filename);
}
Py_CLEAR(__pyx_m);
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init osd");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if CYTHON_PEP489_MULTI_PHASE_INIT
return (__pyx_m != NULL) ? 0 : -1;
#elif PY_MAJOR_VERSION >= 3
return __pyx_m;
#else
return;
#endif
}
/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule(modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, "RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif
/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_getattro))
return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
if (likely(tp->tp_getattr))
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
return PyObject_GetAttr(obj, attr_name);
}
#endif
/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
if (unlikely(!result)) {
PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
"name '%U' is not defined", name);
#else
"name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
}
return result;
}
/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
PyObject *dict = Py_TYPE(obj)->tp_dict;
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
PyObject **dictptr = NULL;
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
dictptr = _PyObject_GetDictPtr(obj);
#endif
}
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
PyObject *dict = Py_TYPE(obj)->tp_dict;
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
return 0;
return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif
/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
if (likely(result)) {
return __Pyx_NewRef(result);
} else if (unlikely(PyErr_Occurred())) {
return NULL;
}
#else
result = PyDict_GetItem(__pyx_d, name);
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
if (likely(result)) {
return __Pyx_NewRef(result);
}
#endif
#else
result = PyObject_GetItem(__pyx_d, name);
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
if (likely(result)) {
return __Pyx_NewRef(result);
}
PyErr_Clear();
#endif
return __Pyx_GetBuiltinName(name);
}
/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
PyObject *self = PyCFunction_GET_SELF(func);
int flags = PyCFunction_GET_FLAGS(func);
assert(PyCFunction_Check(func));
assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
/* _PyCFunction_FastCallDict() must not be called with an exception set,
because it may clear it (directly or indirectly) and so the
caller loses its exception */
assert(!PyErr_Occurred());
if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
} else {
return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
}
}
#endif
/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
PyObject *globals) {
PyFrameObject *f;
PyThreadState *tstate = __Pyx_PyThreadState_Current;
PyObject **fastlocals;
Py_ssize_t i;
PyObject *result;
assert(globals != NULL);
/* XXX Perhaps we should create a specialized
PyFrame_New() that doesn't take locals, but does
take builtins without sanity checking them.
*/
assert(tstate != NULL);
f = PyFrame_New(tstate, co, globals, NULL);
if (f == NULL) {
return NULL;
}
fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
for (i = 0; i < na; i++) {
Py_INCREF(*args);
fastlocals[i] = *args++;
}
result = PyEval_EvalFrameEx(f,0);
++tstate->recursion_depth;
Py_DECREF(f);
--tstate->recursion_depth;
return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
PyObject *globals = PyFunction_GET_GLOBALS(func);
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
PyObject *closure;
#if PY_MAJOR_VERSION >= 3
PyObject *kwdefs;
#endif
PyObject *kwtuple, **k;
PyObject **d;
Py_ssize_t nd;
Py_ssize_t nk;
PyObject *result;
assert(kwargs == NULL || PyDict_Check(kwargs));
nk = kwargs ? PyDict_Size(kwargs) : 0;
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
return NULL;
}
if (
#if PY_MAJOR_VERSION >= 3
co->co_kwonlyargcount == 0 &&
#endif
likely(kwargs == NULL || nk == 0) &&
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
if (argdefs == NULL && co->co_argcount == nargs) {
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
goto done;
}
else if (nargs == 0 && argdefs != NULL
&& co->co_argcount == Py_SIZE(argdefs)) {
/* function called with no arguments, but all parameters have
a default value: use default values as arguments .*/
args = &PyTuple_GET_ITEM(argdefs, 0);
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
goto done;
}
}
if (kwargs != NULL) {
Py_ssize_t pos, i;
kwtuple = PyTuple_New(2 * nk);
if (kwtuple == NULL) {
result = NULL;
goto done;
}
k = &PyTuple_GET_ITEM(kwtuple, 0);
pos = i = 0;
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
Py_INCREF(k[i]);
Py_INCREF(k[i+1]);
i += 2;
}
nk = i / 2;
}
else {
kwtuple = NULL;
k = NULL;
}
closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
if (argdefs != NULL) {
d = &PyTuple_GET_ITEM(argdefs, 0);
nd = Py_SIZE(argdefs);
}
else {
d = NULL;
nd = 0;
}
#if PY_MAJOR_VERSION >= 3
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
args, nargs,
k, (int)nk,
d, (int)nd, kwdefs, closure);
#else
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
args, nargs,
k, (int)nk,
d, (int)nd, closure);
#endif
Py_XDECREF(kwtuple);
done:
Py_LeaveRecursiveCall();
return result;
}
#endif
#endif
/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
PyObject *result;
ternaryfunc call = func->ob_type->tp_call;
if (unlikely(!call))
return PyObject_Call(func, arg, kw);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = (*call)(func, arg, kw);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
PyObject *args, *result = NULL;
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(function)) {
PyObject *args[2] = {arg1, arg2};
return __Pyx_PyFunction_FastCall(function, args, 2);
}
#endif
#if CYTHON_FAST_PYCCALL
if (__Pyx_PyFastCFunction_Check(function)) {
PyObject *args[2] = {arg1, arg2};
return __Pyx_PyCFunction_FastCall(function, args, 2);
}
#endif
args = PyTuple_New(2);
if (unlikely(!args)) goto done;
Py_INCREF(arg1);
PyTuple_SET_ITEM(args, 0, arg1);
Py_INCREF(arg2);
PyTuple_SET_ITEM(args, 1, arg2);
Py_INCREF(function);
result = __Pyx_PyObject_Call(function, args, NULL);
Py_DECREF(args);
Py_DECREF(function);
done:
return result;
}
/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
PyObject *self, *result;
PyCFunction cfunc;
cfunc = PyCFunction_GET_FUNCTION(func);
self = PyCFunction_GET_SELF(func);
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
result = cfunc(self, arg);
Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
"NULL result without error in PyObject_Call");
}
return result;
}
#endif
/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_New(1);
if (unlikely(!args)) return NULL;
Py_INCREF(arg);
PyTuple_SET_ITEM(args, 0, arg);
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(func)) {
return __Pyx_PyFunction_FastCall(func, &arg, 1);
}
#endif
if (likely(PyCFunction_Check(func))) {
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
}
}
return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
PyObject *result;
PyObject *args = PyTuple_Pack(1, arg);
if (unlikely(!args)) return NULL;
result = __Pyx_PyObject_Call(func, args, NULL);
Py_DECREF(args);
return result;
}
#endif
/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
_PyErr_StackItem *exc_info = tstate->exc_info;
while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
exc_info->previous_item != NULL)
{
exc_info = exc_info->previous_item;
}
return exc_info;
}
#endif
/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_USE_EXC_INFO_STACK
_PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
*type = exc_info->exc_type;
*value = exc_info->exc_value;
*tb = exc_info->exc_traceback;
#else
*type = tstate->exc_type;
*value = tstate->exc_value;
*tb = tstate->exc_traceback;
#endif
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_USE_EXC_INFO_STACK
_PyErr_StackItem *exc_info = tstate->exc_info;
tmp_type = exc_info->exc_type;
tmp_value = exc_info->exc_value;
tmp_tb = exc_info->exc_traceback;
exc_info->exc_type = type;
exc_info->exc_value = value;
exc_info->exc_traceback = tb;
#else
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;
#endif
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
}
#endif
/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
PyObject *tmp_type, *tmp_value, *tmp_tb;
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;
#else
PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
if (unlikely(tstate->curexc_type))
#else
if (unlikely(PyErr_Occurred()))
#endif
goto bad;
#if PY_MAJOR_VERSION >= 3
if (local_tb) {
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
}
#endif
Py_XINCREF(local_tb);
Py_XINCREF(local_type);
Py_XINCREF(local_value);
*type = local_type;
*value = local_value;
*tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
#if CYTHON_USE_EXC_INFO_STACK
{
_PyErr_StackItem *exc_info = tstate->exc_info;
tmp_type = exc_info->exc_type;
tmp_value = exc_info->exc_value;
tmp_tb = exc_info->exc_traceback;
exc_info->exc_type = local_type;
exc_info->exc_value = local_value;
exc_info->exc_traceback = local_tb;
}
#else
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;
#endif
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
return 0;
bad:
*type = 0;
*value = 0;
*tb = 0;
Py_XDECREF(local_type);
Py_XDECREF(local_value);
Py_XDECREF(local_tb);
return -1;
}
/* decode_c_string */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
const char* cstring, Py_ssize_t start, Py_ssize_t stop,
const char* encoding, const char* errors,
PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
Py_ssize_t length;
if (unlikely((start < 0) | (stop < 0))) {
size_t slen = strlen(cstring);
if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
PyErr_SetString(PyExc_OverflowError,
"c-string too long to convert to Python");
return NULL;
}
length = (Py_ssize_t) slen;
if (start < 0) {
start += length;
if (start < 0)
start = 0;
}
if (stop < 0)
stop += length;
}
length = stop - start;
if (unlikely(length <= 0))
return PyUnicode_FromUnicode(NULL, 0);
cstring += start;
if (decode_func) {
return decode_func(cstring, length, errors);
} else {
return PyUnicode_Decode(cstring, length, encoding, errors);
}
}
/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
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);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
}
#endif
/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_USE_EXC_INFO_STACK
_PyErr_StackItem *exc_info = tstate->exc_info;
tmp_type = exc_info->exc_type;
tmp_value = exc_info->exc_value;
tmp_tb = exc_info->exc_traceback;
exc_info->exc_type = *type;
exc_info->exc_value = *value;
exc_info->exc_traceback = *tb;
#else
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;
#endif
*type = tmp_type;
*value = tmp_value;
*tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
PyErr_SetExcInfo(*type, *value, *tb);
*type = tmp_type;
*value = tmp_value;
*tb = tmp_tb;
}
#endif
/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
int full_traceback, CYTHON_UNUSED int nogil) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_PyThreadState_declare
#ifdef WITH_THREAD
PyGILState_STATE state;
if (nogil)
state = PyGILState_Ensure();
#ifdef _MSC_VER
else state = (PyGILState_STATE)-1;
#endif
#endif
__Pyx_PyThreadState_assign
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
if (full_traceback) {
Py_XINCREF(old_exc);
Py_XINCREF(old_val);
Py_XINCREF(old_tb);
__Pyx_ErrRestore(old_exc, old_val, old_tb);
PyErr_PrintEx(1);
}
#if PY_MAJOR_VERSION < 3
ctx = PyString_FromString(name);
#else
ctx = PyUnicode_FromString(name);
#endif
__Pyx_ErrRestore(old_exc, old_val, old_tb);
if (!ctx) {
PyErr_WriteUnraisable(Py_None);
} else {
PyErr_WriteUnraisable(ctx);
Py_DECREF(ctx);
}
#ifdef WITH_THREAD
if (nogil)
PyGILState_Release(state);
#endif
}
/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
CYTHON_UNUSED PyObject *cause) {
__Pyx_PyThreadState_declare
Py_XINCREF(type);
if (!value || value == Py_None)
value = NULL;
else
Py_INCREF(value);
if (!tb || tb == Py_None)
tb = NULL;
else {
Py_INCREF(tb);
if (!PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
}
if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
value = Py_None;
}
#endif
PyErr_NormalizeException(&type, &value, &tb);
} else {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
value = type;
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
}
__Pyx_PyThreadState_assign
__Pyx_ErrRestore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
tb = 0;
} else if (tb && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto bad;
}
if (value == Py_None)
value = 0;
if (PyExceptionInstance_Check(type)) {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto bad;
}
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
PyObject *instance_class = NULL;
if (value && PyExceptionInstance_Check(value)) {
instance_class = (PyObject*) Py_TYPE(value);
if (instance_class != type) {
int is_subclass = PyObject_IsSubclass(instance_class, type);
if (!is_subclass) {
instance_class = NULL;
} else if (unlikely(is_subclass == -1)) {
goto bad;
} else {
type = instance_class;
}
}
}
if (!instance_class) {
PyObject *args;
if (!value)
args = PyTuple_New(0);
else if (PyTuple_Check(value)) {
Py_INCREF(value);
args = value;
} else
args = PyTuple_Pack(1, value);
if (!args)
goto bad;
owned_instance = PyObject_Call(type, args, NULL);
Py_DECREF(args);
if (!owned_instance)
goto bad;
value = owned_instance;
if (!PyExceptionInstance_Check(value)) {
PyErr_Format(PyExc_TypeError,
"calling %R should have returned an instance of "
"BaseException, not %R",
type, Py_TYPE(value));
goto bad;
}
}
} else {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto bad;
}
if (cause) {
PyObject *fixed_cause;
if (cause == Py_None) {
fixed_cause = NULL;
} else if (PyExceptionClass_Check(cause)) {
fixed_cause = PyObject_CallObject(cause, NULL);
if (fixed_cause == NULL)
goto bad;
} else if (PyExceptionInstance_Check(cause)) {
fixed_cause = cause;
Py_INCREF(fixed_cause);
} else {
PyErr_SetString(PyExc_TypeError,
"exception causes must derive from "
"BaseException");
goto bad;
}
PyException_SetCause(value, fixed_cause);
}
PyErr_SetObject(type, value);
if (tb) {
#if CYTHON_COMPILING_IN_PYPY
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
Py_INCREF(tb);
PyErr_Restore(tmp_type, tmp_value, tb);
Py_XDECREF(tmp_tb);
#else
PyThreadState *tstate = __Pyx_PyThreadState_Current;
PyObject* tmp_tb = tstate->curexc_traceback;
if (tb != tmp_tb) {
Py_INCREF(tb);
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_tb);
}
#endif
}
bad:
Py_XDECREF(owned_instance);
return;
}
#endif
/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
if (op1 == op2) {
Py_RETURN_TRUE;
}
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(op1))) {
const long b = intval;
long a = PyInt_AS_LONG(op1);
if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
#endif
#if CYTHON_USE_PYLONG_INTERNALS
if (likely(PyLong_CheckExact(op1))) {
int unequal;
unsigned long uintval;
Py_ssize_t size = Py_SIZE(op1);
const digit* digits = ((PyLongObject*)op1)->ob_digit;
if (intval == 0) {
if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
} else if (intval < 0) {
if (size >= 0)
Py_RETURN_FALSE;
intval = -intval;
size = -size;
} else {
if (size <= 0)
Py_RETURN_FALSE;
}
uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 4)) {
unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 3)) {
unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 2)) {
unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 1)) {
unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
#endif
if (PyFloat_CheckExact(op1)) {
const long b = intval;
double a = PyFloat_AS_DOUBLE(op1);
if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
return (
PyObject_RichCompare(op1, op2, Py_EQ));
}
/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
if (op1 == op2) {
Py_RETURN_FALSE;
}
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(op1))) {
const long b = intval;
long a = PyInt_AS_LONG(op1);
if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
#endif
#if CYTHON_USE_PYLONG_INTERNALS
if (likely(PyLong_CheckExact(op1))) {
int unequal;
unsigned long uintval;
Py_ssize_t size = Py_SIZE(op1);
const digit* digits = ((PyLongObject*)op1)->ob_digit;
if (intval == 0) {
if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
} else if (intval < 0) {
if (size >= 0)
Py_RETURN_TRUE;
intval = -intval;
size = -size;
} else {
if (size <= 0)
Py_RETURN_TRUE;
}
uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 4)) {
unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 3)) {
unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 2)) {
unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
if (uintval >> (PyLong_SHIFT * 1)) {
unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
| (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
} else
#endif
unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
#endif
if (PyFloat_CheckExact(op1)) {
const long b = intval;
double a = PyFloat_AS_DOUBLE(op1);
if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
}
return (
PyObject_RichCompare(op1, op2, Py_NE));
}
/* RaiseArgTupleInvalid */
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,
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
PyObject *kwdict,
const char* function_name,
int kw_allowed)
{
PyObject* key = 0;
Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
goto invalid_keyword;
return 1;
#else
while (PyDict_Next(kwdict, &pos, &key, 0)) {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_Check(key)))
#endif
if (unlikely(!PyUnicode_Check(key)))
goto invalid_keyword_type;
}
if ((!kw_allowed) && unlikely(key))
goto invalid_keyword;
return 1;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%.200s() keywords must be strings", function_name);
return 0;
#endif
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
return 0;
}
/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
if (PyFunction_Check(func)) {
return __Pyx_PyFunction_FastCall(func, NULL, 0);
}
#endif
#ifdef __Pyx_CyFunction_USED
if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
if (likely(PyCFunction_Check(func)))
#endif
{
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
return __Pyx_PyObject_CallMethO(func, NULL);
}
}
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif
/* RaiseDoubleKeywords */
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_AsString(kw_name));
#endif
}
/* ParseKeywords */
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;
continue;
}
name = first_kw_arg;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
while (*name) {
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
&& _PyString_Eq(**name, key)) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
if ((**argname == key) || (
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
&& _PyString_Eq(**argname, key))) {
goto arg_passed_twice;
}
argname++;
}
}
} else
#endif
if (likely(PyUnicode_Check(key))) {
while (*name) {
int cmp = (**name == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**name, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
int cmp = (**argname == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**argname, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) goto arg_passed_twice;
argname++;
}
}
} else
goto invalid_keyword_type;
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, key);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%.200s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_setattro))
return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
if (likely(tp->tp_setattr))
return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
return PyObject_SetAttr(obj, attr_name, value);
}
#endif
/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
Py_ssize_t wrapped_i = i;
if (wraparound & unlikely(i < 0)) {
wrapped_i += PyList_GET_SIZE(o);
}
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, wrapped_i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
Py_ssize_t wrapped_i = i;
if (wraparound & unlikely(i < 0)) {
wrapped_i += PyTuple_GET_SIZE(o);
}
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
if (is_list || PyList_CheckExact(o)) {
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else {
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (likely(l >= 0)) {
i += l;
} else {
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
return NULL;
PyErr_Clear();
}
}
return m->sq_item(o, i);
}
}
#else
if (is_list || PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
PyObject *runerr;
Py_ssize_t key_value;
PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
if (unlikely(!(m && m->sq_item))) {
PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
return NULL;
}
key_value = __Pyx_PyIndex_AsSsize_t(index);
if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
}
if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
PyErr_Clear();
PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
}
return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
if (likely(m && m->mp_subscript)) {
return m->mp_subscript(obj, key);
}
return __Pyx_PyObject_GetIndex(obj, key);
}
#endif
/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
(void)inplace;
(void)zerodivision_check;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(op1))) {
const long b = intval;
long x;
long a = PyInt_AS_LONG(op1);
x = (long)((unsigned long)a + b);
if (likely((x^a) >= 0 || (x^b) >= 0))
return PyInt_FromLong(x);
return PyLong_Type.tp_as_number->nb_add(op1, op2);
}
#endif
#if CYTHON_USE_PYLONG_INTERNALS
if (likely(PyLong_CheckExact(op1))) {
const long b = intval;
long a, x;
#ifdef HAVE_LONG_LONG
const PY_LONG_LONG llb = intval;
PY_LONG_LONG lla, llx;
#endif
const digit* digits = ((PyLongObject*)op1)->ob_digit;
const Py_ssize_t size = Py_SIZE(op1);
if (likely(__Pyx_sst_abs(size) <= 1)) {
a = likely(size) ? digits[0] : 0;
if (size == -1) a = -a;
} else {
switch (size) {
case -2:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
case 2:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
case -3:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
case 3:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
case -4:
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
case 4:
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
break;
#ifdef HAVE_LONG_LONG
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
goto long_long;
#endif
}
CYTHON_FALLTHROUGH;
default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
}
}
x = a + b;
return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
long_long:
llx = lla + llb;
return PyLong_FromLongLong(llx);
#endif
}
#endif
if (PyFloat_CheckExact(op1)) {
const long b = intval;
double a = PyFloat_AS_DOUBLE(op1);
double result;
PyFPE_START_PROTECT("add", return NULL)
result = ((double)a) + (double)b;
PyFPE_END_PROTECT(result)
return PyFloat_FromDouble(result);
}
return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif
/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
if (unlikely(!type)) {
PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
else if (exact) {
#if PY_MAJOR_VERSION == 2
if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
#endif
}
else {
if (likely(__Pyx_TypeCheck(obj, type))) return 1;
}
PyErr_Format(PyExc_TypeError,
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
name, type->tp_name, Py_TYPE(obj)->tp_name);
return 0;
}
/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
PyThreadState *tstate = __Pyx_PyThreadState_Current;
PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) {
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
PyObject *exc_value, *exc_tb;
exc_value = tstate->curexc_value;
exc_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
Py_DECREF(exc_type);
Py_XDECREF(exc_value);
Py_XDECREF(exc_tb);
return 0;
} else {
return -1;
}
}
return 0;
#else
if (unlikely(PyErr_Occurred())) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
#endif
}
/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
PyTypeObject *tp = Py_TYPE(obj);
PyObject *descr;
descrgetfunc f = NULL;
PyObject **dictptr, *dict;
int meth_found = 0;
assert (*method == NULL);
if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
attr = __Pyx_PyObject_GetAttrStr(obj, name);
goto try_unpack;
}
if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
return 0;
}
descr = _PyType_Lookup(tp, name);
if (likely(descr != NULL)) {
Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
#ifdef __Pyx_CyFunction_USED
if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
#else
if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
#endif
#else
#ifdef __Pyx_CyFunction_USED
if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
#else
if (likely(PyFunction_Check(descr)))
#endif
#endif
{
meth_found = 1;
} else {
f = Py_TYPE(descr)->tp_descr_get;
if (f != NULL && PyDescr_IsData(descr)) {
attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
Py_DECREF(descr);
goto try_unpack;
}
}
}
dictptr = _PyObject_GetDictPtr(obj);
if (dictptr != NULL && (dict = *dictptr) != NULL) {
Py_INCREF(dict);
attr = __Pyx_PyDict_GetItemStr(dict, name);
if (attr != NULL) {
Py_INCREF(attr);
Py_DECREF(dict);
Py_XDECREF(descr);
goto try_unpack;
}
Py_DECREF(dict);
}
if (meth_found) {
*method = descr;
return 1;
}
if (f != NULL) {
attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
Py_DECREF(descr);
goto try_unpack;
}
if (descr != NULL) {
*method = descr;
return 0;
}
PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
"'%.50s' object has no attribute '%U'",
tp->tp_name, name);
#else
"'%.50s' object has no attribute '%.400s'",
tp->tp_name, PyString_AS_STRING(name));
#endif
return 0;
#else
attr = __Pyx_PyObject_GetAttrStr(obj, name);
goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
PyObject *function = PyMethod_GET_FUNCTION(attr);
Py_INCREF(function);
Py_DECREF(attr);
*method = function;
return 1;
}
#endif
*method = attr;
return 0;
}
/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
PyObject *method = NULL, *result = NULL;
int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
if (likely(is_method)) {
result = __Pyx_PyObject_CallOneArg(method, obj);
Py_DECREF(method);
return result;
}
if (unlikely(!method)) goto bad;
result = __Pyx_PyObject_CallNoArg(method);
Py_DECREF(method);
bad:
return result;
}
/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
index, (index == 1) ? "" : "s");
}
/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}
/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else {
return __Pyx_IterFinish();
}
return 0;
}
/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}
/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
if (t == Py_None) {
__Pyx_RaiseNoneNotIterableError();
} else if (PyTuple_GET_SIZE(t) < index) {
__Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
} else {
__Pyx_RaiseTooManyValuesError(index);
}
}
/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad;
value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad;
#else
value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1);
value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2);
#endif
if (decref_tuple) {
Py_DECREF(tuple);
}
*pvalue1 = value1;
*pvalue2 = value2;
return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
Py_XDECREF(value1);
Py_XDECREF(value2);
if (decref_tuple) { Py_XDECREF(tuple); }
return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
int has_known_size, int decref_tuple) {
Py_ssize_t index;
PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
iternextfunc iternext;
iter = PyObject_GetIter(tuple);
if (unlikely(!iter)) goto bad;
if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
iternext = Py_TYPE(iter)->tp_iternext;
value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
Py_DECREF(iter);
*pvalue1 = value1;
*pvalue2 = value2;
return 0;
unpacking_failed:
if (!has_known_size && __Pyx_IterFinish() == 0)
__Pyx_RaiseNeedMoreValuesError(index);
bad:
Py_XDECREF(iter);
Py_XDECREF(value1);
Py_XDECREF(value2);
if (decref_tuple) { Py_XDECREF(tuple); }
return -1;
}
/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
Py_ssize_t* p_orig_length, int* p_source_is_dict) {
is_dict = is_dict || likely(PyDict_CheckExact(iterable));
*p_source_is_dict = is_dict;
if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
*p_orig_length = PyDict_Size(iterable);
Py_INCREF(iterable);
return iterable;
#elif PY_MAJOR_VERSION >= 3
static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
PyObject **pp = NULL;
if (method_name) {
const char *name = PyUnicode_AsUTF8(method_name);
if (strcmp(name, "iteritems") == 0) pp = &py_items;
else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
else if (strcmp(name, "itervalues") == 0) pp = &py_values;
if (pp) {
if (!*pp) {
*pp = PyUnicode_FromString(name + 4);
if (!*pp)
return NULL;
}
method_name = *pp;
}
}
#endif
}
*p_orig_length = 0;
if (method_name) {
PyObject* iter;
iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
if (!iterable)
return NULL;
#if !CYTHON_COMPILING_IN_PYPY
if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
return iterable;
#endif
iter = PyObject_GetIter(iterable);
Py_DECREF(iterable);
return iter;
}
return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
if (source_is_dict) {
PyObject *key, *value;
if (unlikely(orig_length != PyDict_Size(iter_obj))) {
PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
return -1;
}
if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
return 0;
}
if (pitem) {
PyObject* tuple = PyTuple_New(2);
if (unlikely(!tuple)) {
return -1;
}
Py_INCREF(key);
Py_INCREF(value);
PyTuple_SET_ITEM(tuple, 0, key);
PyTuple_SET_ITEM(tuple, 1, value);
*pitem = tuple;
} else {
if (pkey) {
Py_INCREF(key);
*pkey = key;
}
if (pvalue) {
Py_INCREF(value);
*pvalue = value;
}
}
return 1;
} else if (PyTuple_CheckExact(iter_obj)) {
Py_ssize_t pos = *ppos;
if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
*ppos = pos + 1;
next_item = PyTuple_GET_ITEM(iter_obj, pos);
Py_INCREF(next_item);
} else if (PyList_CheckExact(iter_obj)) {
Py_ssize_t pos = *ppos;
if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
*ppos = pos + 1;
next_item = PyList_GET_ITEM(iter_obj, pos);
Py_INCREF(next_item);
} else
#endif
{
next_item = PyIter_Next(iter_obj);
if (unlikely(!next_item)) {
return __Pyx_IterFinish();
}
}
if (pitem) {
*pitem = next_item;
} else if (pkey && pvalue) {
if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
return -1;
} else if (pkey) {
*pkey = next_item;
} else {
*pvalue = next_item;
}
return 1;
}
/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
Py_ssize_t i, n;
n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
for (i=0; i<n; i++) {
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
}
#endif
for (i=0; i<n; i++) {
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
}
return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
PyObject *exc_type = tstate->curexc_type;
if (exc_type == err) return 1;
if (unlikely(!exc_type)) return 0;
if (unlikely(PyTuple_Check(err)))
return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif
/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
if (likely(PyUnicode_Check(n)))
#else
if (likely(PyString_Check(n)))
#endif
return __Pyx_PyObject_GetAttrStr(o, n);
#endif
return PyObject_GetAttr(o, n);
}
/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
return NULL;
__Pyx_PyErr_Clear();
Py_INCREF(d);
return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
PyObject *r = __Pyx_GetAttr(o, n);
return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}
/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
if (likely(Py_SIZE(n) == -1)) {
return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
}
#if CYTHON_COMPILING_IN_CPYTHON
{
PyObject *copy = _PyLong_Copy((PyLongObject*)n);
if (likely(copy)) {
Py_SIZE(copy) = -(Py_SIZE(copy));
}
return copy;
}
#else
return PyNumber_Negative(n);
#endif
}
#endif
/* PyObjectFormat */
#if CYTHON_USE_UNICODE_WRITER
static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
int ret;
_PyUnicodeWriter writer;
if (likely(PyFloat_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
_PyUnicodeWriter_Init(&writer, 0);
#else
_PyUnicodeWriter_Init(&writer);
#endif
ret = _PyFloat_FormatAdvancedWriter(
&writer,
obj,
format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
} else if (likely(PyLong_CheckExact(obj))) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
_PyUnicodeWriter_Init(&writer, 0);
#else
_PyUnicodeWriter_Init(&writer);
#endif
ret = _PyLong_FormatAdvancedWriter(
&writer,
obj,
format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
} else {
return PyObject_Format(obj, format_spec);
}
if (unlikely(ret == -1)) {
_PyUnicodeWriter_Dealloc(&writer);
return NULL;
}
return _PyUnicodeWriter_Finish(&writer);
}
#endif
/* PyUnicode_Unicode */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) {
if (unlikely(obj == Py_None))
obj = __pyx_kp_u_None;
return __Pyx_NewRef(obj);
}
/* PyObjectFormatAndDecref */
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
if (unlikely(!s)) return NULL;
if (likely(PyUnicode_CheckExact(s))) return s;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(s))) {
PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict");
Py_DECREF(s);
return result;
}
#endif
return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
PyObject *result = PyObject_Format(s, f);
Py_DECREF(s);
return result;
}
/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *result_uval;
int result_ukind;
Py_ssize_t i, char_pos;
void *result_udata;
#if CYTHON_PEP393_ENABLED
result_uval = PyUnicode_New(result_ulength, max_char);
if (unlikely(!result_uval)) return NULL;
result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
result_udata = PyUnicode_DATA(result_uval);
#else
result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
if (unlikely(!result_uval)) return NULL;
result_ukind = sizeof(Py_UNICODE);
result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
char_pos = 0;
for (i=0; i < value_count; i++) {
int ukind;
Py_ssize_t ulength;
void *udata;
PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
if (unlikely(__Pyx_PyUnicode_READY(uval)))
goto bad;
ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
if (unlikely(!ulength))
continue;
if (unlikely(char_pos + ulength < 0))
goto overflow;
ukind = __Pyx_PyUnicode_KIND(uval);
udata = __Pyx_PyUnicode_DATA(uval);
if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
_PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
#else
Py_ssize_t j;
for (j=0; j < ulength; j++) {
Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
__Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
}
#endif
}
char_pos += ulength;
}
return result_uval;
overflow:
PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
Py_DECREF(result_uval);
return NULL;
#else
result_ulength++;
value_count++;
return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}
/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
const double b = floatval;
double a, result;
(void)inplace;
(void)zerodivision_check;
if (likely(PyFloat_CheckExact(op1))) {
a = PyFloat_AS_DOUBLE(op1);
} else
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(op1))) {
a = (double) PyInt_AS_LONG(op1);
} else
#endif
if (likely(PyLong_CheckExact(op1))) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)op1)->ob_digit;
const Py_ssize_t size = Py_SIZE(op1);
switch (size) {
case 0: a = 0.0; break;
case -1: a = -(double) digits[0]; break;
case 1: a = (double) digits[0]; break;
case -2:
case 2:
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
if (size == -2)
a = -a;
break;
}
}
CYTHON_FALLTHROUGH;
case -3:
case 3:
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
if (size == -3)
a = -a;
break;
}
}
CYTHON_FALLTHROUGH;
case -4:
case 4:
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
if (size == -4)
a = -a;
break;
}
}
CYTHON_FALLTHROUGH;
default:
#else
{
#endif
a = PyLong_AsDouble(op1);
if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
}
} else {
return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
PyFPE_START_PROTECT("divide", return NULL)
result = a / b;
PyFPE_END_PROTECT(result)
return PyFloat_FromDouble(result);
}
#endif
/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
PyObject* fake_module;
PyTypeObject* cached_type = NULL;
fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
if (!fake_module) return NULL;
Py_INCREF(fake_module);
cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
if (cached_type) {
if (!PyType_Check((PyObject*)cached_type)) {
PyErr_Format(PyExc_TypeError,
"Shared Cython type %.200s is not a type object",
type->tp_name);
goto bad;
}
if (cached_type->tp_basicsize != type->tp_basicsize) {
PyErr_Format(PyExc_TypeError,
"Shared Cython type %.200s has the wrong size, try recompiling",
type->tp_name);
goto bad;
}
} else {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
PyErr_Clear();
if (PyType_Ready(type) < 0) goto bad;
if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
goto bad;
Py_INCREF(type);
cached_type = type;
}
done:
Py_DECREF(fake_module);
return cached_type;
bad:
Py_XDECREF(cached_type);
cached_type = NULL;
goto done;
}
/* CythonFunction */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
if (unlikely(op->func_doc == NULL)) {
if (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 (unlikely(op->func_doc == NULL))
return NULL;
} else {
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, CYTHON_UNUSED void *context)
{
PyObject *tmp = op->func_doc;
if (value == NULL) {
value = Py_None;
}
Py_INCREF(value);
op->func_doc = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
if (unlikely(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
if (unlikely(op->func_name == NULL))
return NULL;
}
Py_INCREF(op->func_name);
return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
if (unlikely(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_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
Py_INCREF(op->func_qualname);
return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
if (unlikely(value == NULL || !PyString_Check(value)))
#endif
{
PyErr_SetString(PyExc_TypeError,
"__qualname__ must be set to a string object");
return -1;
}
tmp = op->func_qualname;
Py_INCREF(value);
op->func_qualname = 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, CYTHON_UNUSED void *context)
{
if (unlikely(op->func_dict == NULL)) {
op->func_dict = PyDict_New();
if (unlikely(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, CYTHON_UNUSED void *context)
{
PyObject *tmp;
if (unlikely(value == NULL)) {
PyErr_SetString(PyExc_TypeError,
"function's dictionary may not be deleted");
return -1;
}
if (unlikely(!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(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
Py_INCREF(op->func_globals);
return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
PyObject* result = (op->func_code) ? op->func_code : Py_None;
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
int result = 0;
PyObject *res = op->defaults_getter((PyObject *) op);
if (unlikely(!res))
return -1;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
Py_INCREF(op->defaults_tuple);
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
Py_INCREF(op->defaults_kwdict);
#else
op->defaults_tuple = PySequence_ITEM(res, 0);
if (unlikely(!op->defaults_tuple)) result = -1;
else {
op->defaults_kwdict = PySequence_ITEM(res, 1);
if (unlikely(!op->defaults_kwdict)) result = -1;
}
#endif
Py_DECREF(res);
return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
PyObject* tmp;
if (!value) {
value = Py_None;
} else if (value != Py_None && !PyTuple_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__defaults__ must be set to a tuple object");
return -1;
}
Py_INCREF(value);
tmp = op->defaults_tuple;
op->defaults_tuple = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
PyObject* result = op->defaults_tuple;
if (unlikely(!result)) {
if (op->defaults_getter) {
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
result = op->defaults_tuple;
} else {
result = Py_None;
}
}
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
PyObject* tmp;
if (!value) {
value = Py_None;
} else if (value != Py_None && !PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__kwdefaults__ must be set to a dict object");
return -1;
}
Py_INCREF(value);
tmp = op->defaults_kwdict;
op->defaults_kwdict = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
PyObject* result = op->defaults_kwdict;
if (unlikely(!result)) {
if (op->defaults_getter) {
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
result = op->defaults_kwdict;
} else {
result = Py_None;
}
}
Py_INCREF(result);
return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
PyObject* tmp;
if (!value || value == Py_None) {
value = NULL;
} else if (!PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"__annotations__ must be set to a dict object");
return -1;
}
Py_XINCREF(value);
tmp = op->func_annotations;
op->func_annotations = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
PyObject* result = op->func_annotations;
if (unlikely(!result)) {
result = PyDict_New();
if (unlikely(!result)) return NULL;
op->func_annotations = result;
}
Py_INCREF(result);
return result;
}
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 *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 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, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
{0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
{(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, 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[] = {
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
__Pyx_CyFunction_weakreflist(op) = 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;
Py_INCREF(qualname);
op->func_qualname = qualname;
op->func_doc = NULL;
op->func_classobj = NULL;
op->func_globals = globals;
Py_INCREF(op->func_globals);
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
op->defaults_kwdict = NULL;
op->defaults_getter = NULL;
op->func_annotations = 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_qualname);
Py_CLEAR(m->func_doc);
Py_CLEAR(m->func_globals);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
Py_CLEAR(m->defaults_kwdict);
Py_CLEAR(m->func_annotations);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_XDECREF(pydefaults[i]);
PyObject_Free(m->defaults);
m->defaults = NULL;
}
return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
if (__Pyx_CyFunction_weakreflist(m) != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
__Pyx__CyFunction_dealloc(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_qualname);
Py_VISIT(m->func_doc);
Py_VISIT(m->func_globals);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
Py_VISIT(m->defaults_kwdict);
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 __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
}
if (obj == Py_None)
obj = NULL;
return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromFormat("<cyfunction %U at %p>",
op->func_qualname, (void *)op);
#else
return PyString_FromFormat("<cyfunction %s at %p>",
PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
PyCFunctionObject* f = (PyCFunctionObject*)func;
PyCFunction meth = f->m_ml->ml_meth;
Py_ssize_t size;
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
case METH_VARARGS:
if (likely(kw == NULL || PyDict_Size(kw) == 0))
return (*meth)(self, arg);
break;
case METH_VARARGS | METH_KEYWORDS:
return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
case METH_NOARGS:
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
size = PyTuple_GET_SIZE(arg);
if (likely(size == 0))
return (*meth)(self, NULL);
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
case METH_O:
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
size = PyTuple_GET_SIZE(arg);
if (likely(size == 1)) {
PyObject *result, *arg0;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
arg0 = PyTuple_GET_ITEM(arg, 0);
#else
arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
#endif
result = (*meth)(self, arg0);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF(arg0);
#endif
return result;
}
PyErr_Format(PyExc_TypeError,
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
f->m_ml->ml_name, size);
return NULL;
}
break;
default:
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
"longer supported!");
return NULL;
}
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
f->m_ml->ml_name);
return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
PyObject *result;
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
Py_ssize_t argc;
PyObject *new_args;
PyObject *self;
argc = PyTuple_GET_SIZE(args);
new_args = PyTuple_GetSlice(args, 1, argc);
if (unlikely(!new_args))
return NULL;
self = PyTuple_GetItem(args, 0);
if (unlikely(!self)) {
Py_DECREF(new_args);
return NULL;
}
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
Py_DECREF(new_args);
} else {
result = __Pyx_CyFunction_Call(func, args, kw);
}
return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
"cython_function_or_method",
sizeof(__pyx_CyFunctionObject),
0,
(destructor) __Pyx_CyFunction_dealloc,
0,
0,
0,
#if PY_MAJOR_VERSION < 3
0,
#else
0,
#endif
(reprfunc) __Pyx_CyFunction_repr,
0,
0,
0,
0,
__Pyx_CyFunction_CallAsMethod,
0,
0,
0,
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
0,
(traverseproc) __Pyx_CyFunction_traverse,
(inquiry) __Pyx_CyFunction_clear,
0,
#if PY_VERSION_HEX < 0x030500A0
offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
offsetof(PyCFunctionObject, m_weakreflist),
#endif
0,
0,
__pyx_CyFunction_methods,
__pyx_CyFunction_members,
__pyx_CyFunction_getsets,
0,
0,
__Pyx_CyFunction_descr_get,
0,
offsetof(__pyx_CyFunctionObject, func_dict),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
#if PY_VERSION_HEX >= 0x030400a1
0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
0,
#endif
};
static int __pyx_CyFunction_init(void) {
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
if (unlikely(__pyx_CyFunctionType == NULL)) {
return -1;
}
return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults = PyObject_Malloc(size);
if (unlikely(!m->defaults))
return PyErr_NoMemory();
memset(m->defaults, 0, size);
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_kwdict = dict;
Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->func_annotations = dict;
Py_INCREF(dict);
}
/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
PyObject *value;
value = PyDict_GetItemWithError(d, key);
if (unlikely(!value)) {
if (!PyErr_Occurred()) {
if (unlikely(PyTuple_Check(key))) {
PyObject* args = PyTuple_Pack(1, key);
if (likely(args)) {
PyErr_SetObject(PyExc_KeyError, args);
Py_DECREF(args);
}
} else {
PyErr_SetObject(PyExc_KeyError, key);
}
}
return NULL;
}
Py_INCREF(value);
return value;
}
#endif
/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
#if PY_MAJOR_VERSION < 3
PyObject *py_import;
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
if (!py_import)
goto bad;
#endif
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_MAJOR_VERSION >= 3
if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) {
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, 1);
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
}
}
level = 0;
}
#endif
if (!module) {
#if PY_MAJOR_VERSION < 3
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
Py_DECREF(py_level);
#else
module = PyImport_ImportModuleLevelObject(
name, global_dict, empty_dict, list, level);
#endif
}
}
bad:
#if PY_MAJOR_VERSION < 3
Py_XDECREF(py_import);
#endif
Py_XDECREF(empty_list);
Py_XDECREF(empty_dict);
return module;
}
/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Format(PyExc_ImportError,
#if PY_MAJOR_VERSION < 3
"cannot import name %.230s", PyString_AS_STRING(name));
#else
"cannot import name %S", name);
#endif
}
return value;
}
/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
PyObject *r;
if (unlikely(!__Pyx_PyBaseString_Check(n))) {
PyErr_SetString(PyExc_TypeError,
"hasattr(): attribute name must be string");
return -1;
}
r = __Pyx_GetAttr(o, n);
if (unlikely(!r)) {
PyErr_Clear();
return 0;
} else {
Py_DECREF(r);
return 1;
}
}
/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
"'%.50s' object has no attribute '%U'",
tp->tp_name, attr_name);
#else
"'%.50s' object has no attribute '%.400s'",
tp->tp_name, PyString_AS_STRING(attr_name));
#endif
return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
PyObject *descr;
PyTypeObject *tp = Py_TYPE(obj);
if (unlikely(!PyString_Check(attr_name))) {
return PyObject_GenericGetAttr(obj, attr_name);
}
assert(!tp->tp_dictoffset);
descr = _PyType_Lookup(tp, attr_name);
if (unlikely(!descr)) {
return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
}
Py_INCREF(descr);
#if PY_MAJOR_VERSION < 3
if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
#endif
{
descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
if (unlikely(f)) {
PyObject *res = f(descr, obj, (PyObject *)tp);
Py_DECREF(descr);
return res;
}
}
return descr;
}
#endif
/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
return PyObject_GenericGetAttr(obj, attr_name);
}
return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif
/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
int ret;
PyObject *name_attr;
name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
if (likely(name_attr)) {
ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
} else {
ret = -1;
}
if (unlikely(ret < 0)) {
PyErr_Clear();
ret = 0;
}
Py_XDECREF(name_attr);
return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
int ret = 0;
PyObject *object_reduce = NULL;
PyObject *object_reduce_ex = NULL;
PyObject *reduce = NULL;
PyObject *reduce_ex = NULL;
PyObject *reduce_cython = NULL;
PyObject *setstate = NULL;
PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
if (!setstate) PyErr_Clear();
if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
}
PyType_Modified((PyTypeObject*)type_obj);
}
}
goto GOOD;
BAD:
if (!PyErr_Occurred())
PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
Py_XDECREF(object_reduce);
Py_XDECREF(object_reduce_ex);
#endif
Py_XDECREF(reduce);
Py_XDECREF(reduce_ex);
Py_XDECREF(reduce_cython);
Py_XDECREF(setstate);
Py_XDECREF(setstate_cython);
return ret;
}
/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
for (i=0; i < nbases; i++) {
PyTypeObject *tmptype;
PyObject *tmp = PyTuple_GET_ITEM(bases, i);
tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
if (tmptype == &PyClass_Type)
continue;
#endif
if (!metaclass) {
metaclass = tmptype;
continue;
}
if (PyType_IsSubtype(metaclass, tmptype))
continue;
if (PyType_IsSubtype(tmptype, metaclass)) {
metaclass = tmptype;
continue;
}
PyErr_SetString(PyExc_TypeError,
"metaclass conflict: "
"the metaclass of a derived class "
"must be a (non-strict) subclass "
"of the metaclasses of all its bases");
return NULL;
}
if (!metaclass) {
#if PY_MAJOR_VERSION < 3
metaclass = &PyClass_Type;
#else
metaclass = &PyType_Type;
#endif
}
Py_INCREF((PyObject*) metaclass);
return (PyObject*) metaclass;
}
/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
PyObject *ns;
if (metaclass) {
PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
if (prep) {
PyObject *pargs = PyTuple_Pack(2, name, bases);
if (unlikely(!pargs)) {
Py_DECREF(prep);
return NULL;
}
ns = PyObject_Call(prep, pargs, mkw);
Py_DECREF(prep);
Py_DECREF(pargs);
} else {
if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
return NULL;
PyErr_Clear();
ns = PyDict_New();
}
} else {
ns = PyDict_New();
}
if (unlikely(!ns))
return NULL;
if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
return ns;
bad:
Py_DECREF(ns);
return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
PyObject *dict, PyObject *mkw,
int calculate_metaclass, int allow_py2_metaclass) {
PyObject *result, *margs;
PyObject *owned_metaclass = NULL;
if (allow_py2_metaclass) {
owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
if (owned_metaclass) {
metaclass = owned_metaclass;
} else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
PyErr_Clear();
} else {
return NULL;
}
}
if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
Py_XDECREF(owned_metaclass);
if (unlikely(!metaclass))
return NULL;
owned_metaclass = metaclass;
}
margs = PyTuple_Pack(3, name, bases, dict);
if (unlikely(!margs)) {
result = NULL;
} else {
result = PyObject_Call(metaclass, margs, mkw);
Py_DECREF(margs);
}
Py_XDECREF(owned_metaclass);
return result;
}
/* PyType_Ready */
static int __Pyx_PyType_Ready(PyTypeObject *t) {
int r;
PyObject *bases = t->tp_bases;
if (bases)
{
Py_ssize_t i, n = PyTuple_GET_SIZE(bases);
for (i = 1; i < n; i++)
{
PyObject *b0 = PyTuple_GET_ITEM(bases, i);
PyTypeObject *b;
#if PY_MAJOR_VERSION < 3
if (PyClass_Check(b0))
{
PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
return -1;
}
#endif
b = (PyTypeObject*)b0;
if (!PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
{
PyErr_Format(PyExc_TypeError, "base class '%.200s' is not a heap type",
b->tp_name);
return -1;
}
if (t->tp_dictoffset == 0 && b->tp_dictoffset)
{
PyErr_Format(PyExc_TypeError,
"extension type '%.200s' has no __dict__ slot, but base type '%.200s' has: "
"either add 'cdef dict __dict__' to the extension type "
"or add '__slots__ = [...]' to the base type",
t->tp_name, b->tp_name);
return -1;
}
}
}
#if PY_VERSION_HEX >= 0x03050000
t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
#endif
r = PyType_Ready(t);
#if PY_VERSION_HEX >= 0x03050000
t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
#endif
return r;
}
/* GetNameInClass */
static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
PyObject *result;
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
return NULL;
__Pyx_PyErr_Clear();
__Pyx_GetModuleGlobalNameUncached(result, name);
return result;
}
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
PyObject *result;
result = __Pyx_PyObject_GetAttrStr(nmspace, name);
if (!result) {
result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
}
return result;
}
/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
PyObject *use_cline;
PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
PyObject **cython_runtime_dict;
#endif
if (unlikely(!__pyx_cython_runtime)) {
return c_line;
}
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
if (likely(cython_runtime_dict)) {
__PYX_PY_DICT_LOOKUP_IF_MODIFIED(
use_cline, *cython_runtime_dict,
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
} else
#endif
{
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
if (use_cline_obj) {
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
Py_DECREF(use_cline_obj);
} else {
PyErr_Clear();
use_cline = NULL;
}
}
if (!use_cline) {
c_line = 0;
PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
}
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
c_line = 0;
}
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
return c_line;
}
#endif
/* CodeObjectCache */
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 - start) / 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, (size_t)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);
}
/* AddTraceback */
#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,
0,
0,
0,
0,
__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,
__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;
PyFrameObject *py_frame = 0;
PyThreadState *tstate = __Pyx_PyThreadState_Current;
if (c_line) {
c_line = __Pyx_CLineForTraceback(tstate, c_line);
}
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_frame = PyFrame_New(
tstate, /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
__pyx_d, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
{\
func_type value = func_value;\
if (sizeof(target_type) < sizeof(func_type)) {\
if (unlikely(value != (func_type) (target_type) value)) {\
func_type zero = 0;\
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
return (target_type) -1;\
if (is_unsigned && unlikely(value < zero))\
goto raise_neg_overflow;\
else\
goto raise_overflow;\
}\
}\
return (target_type) value;\
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) {
const uint16_t neg_one = (uint16_t) ((uint16_t) 0 - (uint16_t) 1), const_zero = (uint16_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(uint16_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(uint16_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(uint16_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(uint16_t),
little, !is_unsigned);
}
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(int) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(int) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(int) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(int),
little, !is_unsigned);
}
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_osd_result(osd_result value) {
const osd_result neg_one = (osd_result) ((osd_result) 0 - (osd_result) 1), const_zero = (osd_result) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(osd_result) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(osd_result) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(osd_result) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(osd_result) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(osd_result) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(osd_result),
little, !is_unsigned);
}
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(unsigned int) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(unsigned int) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
little, !is_unsigned);
}
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(uint64_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(uint64_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
little, !is_unsigned);
}
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) {
const uint8_t neg_one = (uint8_t) ((uint8_t) 0 - (uint8_t) 1), const_zero = (uint8_t) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(uint8_t) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(uint8_t) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(uint8_t),
little, !is_unsigned);
}
}
static PyObject* __pyx_convert__to_py_struct__osd_mem_desc_region(struct osd_mem_desc_region s) {
PyObject* res;
PyObject* member;
res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL;
member = __Pyx_PyInt_From_uint64_t(s.baseaddr); if (unlikely(!member)) goto bad;
if (unlikely(PyDict_SetItem(res, __pyx_n_s_baseaddr, member) < 0)) goto bad;
Py_DECREF(member);
member = __Pyx_PyInt_From_uint64_t(s.memsize); if (unlikely(!member)) goto bad;
if (unlikely(PyDict_SetItem(res, __pyx_n_s_memsize, member) < 0)) goto bad;
Py_DECREF(member);
return res;
bad:
Py_XDECREF(member);
Py_DECREF(res);
return NULL;
}
/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
const int is_unsigned = neg_one > const_zero;
if (is_unsigned) {
if (sizeof(long) < sizeof(long)) {
return PyInt_FromLong((long) value);
} else if (sizeof(long) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
}
} else {
if (sizeof(long) <= sizeof(long)) {
return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
}
}
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
return _PyLong_FromByteArray(bytes, sizeof(long),
little, !is_unsigned);
}
}
/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(long) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (long) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (long) 0;
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
case 2:
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (long) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(long) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (long) 0;
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
case -2:
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
}
}
break;
}
#endif
if (sizeof(long) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
long val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (long) -1;
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (long) -1;
val = __Pyx_PyInt_As_long(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to long");
return (long) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long) -1;
}
/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(int) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (int) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int) 0;
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
case 2:
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (int) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(int) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (int) 0;
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
case -2:
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
}
}
break;
}
#endif
if (sizeof(int) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
int val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (int) -1;
}
} else {
int val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (int) -1;
val = __Pyx_PyInt_As_int(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to int");
return (int) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to int");
return (int) -1;
}
/* CIntFromPy */
static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) {
const uint16_t neg_one = (uint16_t) ((uint16_t) 0 - (uint16_t) 1), const_zero = (uint16_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(uint16_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (uint16_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint16_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, digits[0])
case 2:
if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT) {
return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT) {
return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) >= 4 * PyLong_SHIFT) {
return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (uint16_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(uint16_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint16_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(uint16_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, +digits[0])
case -2:
if (8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT) {
return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint16_t) - 1 > 4 * PyLong_SHIFT) {
return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(uint16_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
uint16_t val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (uint16_t) -1;
}
} else {
uint16_t val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (uint16_t) -1;
val = __Pyx_PyInt_As_uint16_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to uint16_t");
return (uint16_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to uint16_t");
return (uint16_t) -1;
}
/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(size_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (size_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (size_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
case 2:
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (size_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(size_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (size_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
case -2:
if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(size_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
size_t val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (size_t) -1;
}
} else {
size_t val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (size_t) -1;
val = __Pyx_PyInt_As_size_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to size_t");
return (size_t) -1;
}
/* CIntFromPy */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(unsigned int) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (unsigned int) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (unsigned int) 0;
case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
case 2:
if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (unsigned int) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(unsigned int) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (unsigned int) 0;
case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0])
case -2:
if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
}
}
break;
}
#endif
if (sizeof(unsigned int) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
unsigned int val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (unsigned int) -1;
}
} else {
unsigned int val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (unsigned int) -1;
val = __Pyx_PyInt_As_unsigned_int(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to unsigned int");
return (unsigned int) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned int");
return (unsigned int) -1;
}
/* CIntFromPy */
static CYTHON_INLINE enum osd_packet_type __Pyx_PyInt_As_enum__osd_packet_type(PyObject *x) {
const enum osd_packet_type neg_one = (enum osd_packet_type) ((enum osd_packet_type) 0 - (enum osd_packet_type) 1), const_zero = (enum osd_packet_type) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(enum osd_packet_type) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (enum osd_packet_type) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum osd_packet_type) 0;
case 1: __PYX_VERIFY_RETURN_INT(enum osd_packet_type, digit, digits[0])
case 2:
if (8 * sizeof(enum osd_packet_type) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) >= 2 * PyLong_SHIFT) {
return (enum osd_packet_type) (((((enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(enum osd_packet_type) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) >= 3 * PyLong_SHIFT) {
return (enum osd_packet_type) (((((((enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(enum osd_packet_type) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) >= 4 * PyLong_SHIFT) {
return (enum osd_packet_type) (((((((((enum osd_packet_type)digits[3]) << PyLong_SHIFT) | (enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (enum osd_packet_type) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(enum osd_packet_type) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum osd_packet_type, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(enum osd_packet_type) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum osd_packet_type, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (enum osd_packet_type) 0;
case -1: __PYX_VERIFY_RETURN_INT(enum osd_packet_type, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(enum osd_packet_type, digit, +digits[0])
case -2:
if (8 * sizeof(enum osd_packet_type) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 2 * PyLong_SHIFT) {
return (enum osd_packet_type) (((enum osd_packet_type)-1)*(((((enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(enum osd_packet_type) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 2 * PyLong_SHIFT) {
return (enum osd_packet_type) ((((((enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(enum osd_packet_type) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 3 * PyLong_SHIFT) {
return (enum osd_packet_type) (((enum osd_packet_type)-1)*(((((((enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(enum osd_packet_type) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 3 * PyLong_SHIFT) {
return (enum osd_packet_type) ((((((((enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(enum osd_packet_type) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 4 * PyLong_SHIFT) {
return (enum osd_packet_type) (((enum osd_packet_type)-1)*(((((((((enum osd_packet_type)digits[3]) << PyLong_SHIFT) | (enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(enum osd_packet_type) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(enum osd_packet_type, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(enum osd_packet_type) - 1 > 4 * PyLong_SHIFT) {
return (enum osd_packet_type) ((((((((((enum osd_packet_type)digits[3]) << PyLong_SHIFT) | (enum osd_packet_type)digits[2]) << PyLong_SHIFT) | (enum osd_packet_type)digits[1]) << PyLong_SHIFT) | (enum osd_packet_type)digits[0])));
}
}
break;
}
#endif
if (sizeof(enum osd_packet_type) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(enum osd_packet_type, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(enum osd_packet_type) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(enum osd_packet_type, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
enum osd_packet_type val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (enum osd_packet_type) -1;
}
} else {
enum osd_packet_type val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (enum osd_packet_type) -1;
val = __Pyx_PyInt_As_enum__osd_packet_type(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to enum osd_packet_type");
return (enum osd_packet_type) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to enum osd_packet_type");
return (enum osd_packet_type) -1;
}
/* CIntFromPy */
static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) {
const uint8_t neg_one = (uint8_t) ((uint8_t) 0 - (uint8_t) 1), const_zero = (uint8_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(uint8_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (uint8_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint8_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0])
case 2:
if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) {
return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) {
return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) >= 4 * PyLong_SHIFT) {
return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (uint8_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(uint8_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint8_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0])
case -2:
if (8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) {
return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint8_t) - 1 > 4 * PyLong_SHIFT) {
return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(uint8_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
uint8_t val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (uint8_t) -1;
}
} else {
uint8_t val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (uint8_t) -1;
val = __Pyx_PyInt_As_uint8_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to uint8_t");
return (uint8_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to uint8_t");
return (uint8_t) -1;
}
/* CIntFromPy */
static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(uint64_t) < sizeof(long)) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
goto raise_neg_overflow;
}
return (uint64_t) val;
}
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint64_t) 0;
case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
case 2:
if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
case 3:
if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
case 4:
if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
}
}
break;
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(Py_SIZE(x) < 0)) {
goto raise_neg_overflow;
}
#else
{
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
if (unlikely(result < 0))
return (uint64_t) -1;
if (unlikely(result == 1))
goto raise_neg_overflow;
}
#endif
if (sizeof(uint64_t) <= sizeof(unsigned long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
}
} else {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return (uint64_t) 0;
case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
case 1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, +digits[0])
case -2:
if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 2:
if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case -3:
if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 3:
if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case -4:
if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
case 4:
if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
__PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
} else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
}
}
break;
}
#endif
if (sizeof(uint64_t) <= sizeof(long)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
} else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
__PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
}
}
{
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
PyErr_SetString(PyExc_RuntimeError,
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
uint64_t val;
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
#if PY_MAJOR_VERSION < 3
if (likely(v) && !PyLong_Check(v)) {
PyObject *tmp = v;
v = PyNumber_Long(tmp);
Py_DECREF(tmp);
}
#endif
if (likely(v)) {
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
bytes, sizeof(val),
is_little, !is_unsigned);
Py_DECREF(v);
if (likely(!ret))
return val;
}
#endif
return (uint64_t) -1;
}
} else {
uint64_t val;
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
if (!tmp) return (uint64_t) -1;
val = __Pyx_PyInt_As_uint64_t(tmp);
Py_DECREF(tmp);
return val;
}
raise_overflow:
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to uint64_t");
return (uint64_t) -1;
raise_neg_overflow:
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to uint64_t");
return (uint64_t) -1;
}
/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
while (a) {
a = a->tp_base;
if (a == b)
return 1;
}
return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
PyObject *mro;
if (a == b) return 1;
mro = a->tp_mro;
if (likely(mro)) {
Py_ssize_t i, n;
n = PyTuple_GET_SIZE(mro);
for (i = 0; i < n; i++) {
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
return 1;
}
return 0;
}
return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
PyObject *exception, *value, *tb;
int res;
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__Pyx_ErrFetch(&exception, &value, &tb);
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
if (unlikely(res == -1)) {
PyErr_WriteUnraisable(err);
res = 0;
}
if (!res) {
res = PyObject_IsSubclass(err, exc_type2);
if (unlikely(res == -1)) {
PyErr_WriteUnraisable(err);
res = 0;
}
}
__Pyx_ErrRestore(exception, value, tb);
return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
if (!res) {
res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
}
return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
Py_ssize_t i, n;
assert(PyExceptionClass_Check(exc_type));
n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
for (i=0; i<n; i++) {
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
}
#endif
for (i=0; i<n; i++) {
PyObject *t = PyTuple_GET_ITEM(tuple, i);
#if PY_MAJOR_VERSION < 3
if (likely(exc_type == t)) return 1;
#endif
if (likely(PyExceptionClass_Check(t))) {
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
} else {
}
}
return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
if (likely(err == exc_type)) return 1;
if (likely(PyExceptionClass_Check(err))) {
if (likely(PyExceptionClass_Check(exc_type))) {
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
} else if (likely(PyTuple_Check(exc_type))) {
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
} else {
}
}
return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
assert(PyExceptionClass_Check(exc_type1));
assert(PyExceptionClass_Check(exc_type2));
if (likely(err == exc_type1 || err == exc_type2)) return 1;
if (likely(PyExceptionClass_Check(err))) {
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
}
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif
/* CheckBinaryVersion */
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);
return PyErr_WarnEx(NULL, message, 1);
}
return 0;
}
/* InitStrings */
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
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;
if (PyObject_Hash(*t->p) == -1)
return -1;
++t;
}
return 0;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
char* defenc_c;
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
if (!defenc) return NULL;
defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
{
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
char* c;
for (c = defenc_c; c < end; c++) {
if ((unsigned char) (*c) >= 128) {
PyUnicode_AsASCIIString(o);
return NULL;
}
}
}
#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (likely(PyUnicode_IS_ASCII(o))) {
*length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
#else
return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii &&
#endif
PyUnicode_Check(o)) {
return __Pyx_PyUnicode_AsStringAndSize(o, length);
} else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
if (PyByteArray_Check(o)) {
*length = PyByteArray_GET_SIZE(o);
return PyByteArray_AS_STRING(o);
} else
#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
if (unlikely(r < 0)) {
return NULL;
} else {
return result;
}
}
}
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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
int retval;
if (unlikely(!x)) return -1;
retval = __Pyx_PyObject_IsTrue(x);
Py_DECREF(x);
return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
if (PyLong_Check(result)) {
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"__int__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python.",
Py_TYPE(result)->tp_name)) {
Py_DECREF(result);
return NULL;
}
return result;
}
#endif
PyErr_Format(PyExc_TypeError,
"__%.4s__ returned non-%.4s (type %.200s)",
type_name, type_name, Py_TYPE(result)->tp_name);
Py_DECREF(result);
return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
PyNumberMethods *m;
#endif
const char *name = NULL;
PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
if (likely(PyLong_Check(x)))
#endif
return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
if (m && m->nb_int) {
name = "int";
res = m->nb_int(x);
}
else if (m && m->nb_long) {
name = "long";
res = m->nb_long(x);
}
#else
if (likely(m && m->nb_int)) {
name = "int";
res = m->nb_int(x);
}
#endif
#else
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
res = PyNumber_Int(x);
}
#endif
if (likely(res)) {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
if (unlikely(!PyLong_CheckExact(res))) {
#endif
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
}
}
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;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(b))) {
if (sizeof(Py_ssize_t) >= sizeof(long))
return PyInt_AS_LONG(b);
else
return PyInt_AsSsize_t(b);
}
#endif
if (likely(PyLong_CheckExact(b))) {
#if CYTHON_USE_PYLONG_INTERNALS
const digit* digits = ((PyLongObject*)b)->ob_digit;
const Py_ssize_t size = Py_SIZE(b);
if (likely(__Pyx_sst_abs(size) <= 1)) {
ival = likely(size) ? digits[0] : 0;
if (size == -1) ival = -ival;
return ival;
} else {
switch (size) {
case 2:
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -2:
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case 3:
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -3:
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case 4:
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
case -4:
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
}
break;
}
}
#endif
return PyLong_AsSsize_t(b);
}
x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
return PyInt_FromSize_t(ival);
}
#endif /* Py_PYTHON_H */
|
Shamilv05/findErrors
|
task.c
|
<reponame>Shamilv05/findErrors<gh_stars>1-10
/**
* @brief
* Find errors and decrease probability of getting errors of the same kind in the future
* This piece of code won't compile and it doesn't describe an entire algorithm: just part of some page storage
*
* @author
* AnnaM
*/
#include <Windows.h>
#include <stdio.h>
enum PAGE_COLOR
{
PG_COLOR_GREEN = 1, /* page may be released without high overhead */
PG_COLOR_YELLOW, /* nice to have */
PG_COLOR_RED /* page is actively used */
};
/**
* UINT Key of a page in hash-table (prepared from color and address)
*/
union PageKey
{
struct
{
CHAR cColor: 8;
UINT cAddr: 24;
};
UINT uKey;
};
/* Prepare from 2 chars the key of the same configuration as in PageKey */
#define CALC_PAGE_KEY( Addr, Color ) ( (Color) + (Addr) << 8 )
/**
* Descriptor of a single guest physical page
*/
struct PageDesc
{
PageKey uKey;
/* list support */
PageDesc *next, *prev;
};
#define PAGE_INIT( Desc, Addr, Color ) \
{ \
(Desc).uKey = CALC_PAGE_KEY( Addr, Color ); \
(Desc).next = (Desc).prev = NULL; \
}
/* storage for pages of all colors */
static PageDesc* PageStrg[ 3 ];
void PageStrgInit()
{
memset( PageStrg, 0, sizeof(&PageStrg) );
}
PageDesc* PageFind( void* ptr, char color )
{
for( PageDesc* Pg = PageStrg[color]; Pg; Pg = Pg->next );
if( Pg->uKey == CALC_PAGE_KEY(ptr,color) )
return Pg;
return NULL;
}
PageDesc* PageReclaim( UINT cnt )
{
UINT color = 0;
PageDesc* Pg;
while( cnt )
{
Pg = Pg->next;
PageRemove( PageStrg[ color ] );
cnt--;
if( Pg == NULL )
{
color++;
Pg = PageStrg[ color ];
}
}
}
PageDesc* PageInit( void* ptr, UINT color )
{
PageDesc* pg = new PageDesc;
if( pg )
PAGE_INIT(&pg, ptr, color);
else
printf("Allocation has failed\n");
return pg;
}
/**
* Print all mapped pages
*/
void PageDump()
{
UINT color = 0;
#define PG_COLOR_NAME(clr) #clr
char* PgColorName[] =
{
PG_COLOR_NAME(PG_COLOR_RED),
PG_COLOR_NAME(PG_COLOR_YELLOW),
PG_COLOR_NAME(PG_COLOR_GREEN)
};
while( color <= PG_COLOR_RED )
{
printf("PgStrg[(%s) %u] ********** \n", color, PgColorName[color] );
for( PageDesc* Pg = PageStrg[++color]; Pg != NULL; Pg = Pg->next )
{
if( Pg->uAddr = NULL )
continue;
printf("Pg :Key = 0x%x, addr %p\n", Pg->uKey, Pg->uAddr );
}
}
#undef PG_COLOR_NAME
}
|
Panzerschrek/Harp-Simulator
|
spectrum.h
|
<filename>spectrum.h
static const float in1[]=
{
1.0f,
0.43f,
0.46f,
0.046f,
0.19f,
0.014f,
0.08f,
0.08f,
0.4f,
0.253f,
0.564f,
0.278f,
0.21f,
0.089f,
0.16f,
0.27f,
0.15f,
0.2f,
0.09f,
0.075f,
0.035f,
0.075f,
0.028f,
0.057f,
};
static const float out1[]=
{
1.0f,
0.117f,
0.325f,
0.0357f,
0.117f,
0.125f,
0.171f,
0.0964f,
0.425f,
0.2f,
0.139f,
0.057f,
0.057f,
0.039f,
0.0142f,
0.057f,
0.0357f,
0.032f,
};
static const float in2[]=
{
1.0f,
0.325f,
0.31f,
0.07f,
0.082f,
0.039f,
0.092f,
0.192f,
0.532f,
0.228f,
0.221f,
0.228f,
0.167f,
0.103f,
0.125f,
0.0535f,
0.035f,
0.0f,
0.0214f,
0.042f,
0.0214f,
};
static const float out2[]=
{
1.0f,
0.1f,
0.1678f,
0.0571f,
0.1571f,
0.146f,
0.196f,
0.0714f,
0.0571f,
0.0321f,
0.017f,
0.0535f,
0.05f,
0.046f,
0.032f,
0.01f
};
static const float in3[]=
{
1.0f,
0.246f,
0.178f,
0.0821f,
0.067f,
0.357f,
0.539f,
0.239f,
0.189f,
0.35f,
0.121f,
0.125f,
0.092f,
0.0714f,
0.05f,
0.0321f,
0.067f,
0.0821f,
0.11f,
0.085f,
0.075f,
0.01f
};
static const float out3[]=
{
1.0f,
0.03f,
0.535f,
0.15f,
0.25f,
0.207f,
0.039f,
0.0964f,
0.057f,
0.1f,
0.021f,
0.067f,
0.014f,
0.028f,
0.01f,
0.0535f,
0.021f,
0.014f
};
static const float in4[]=
{
1.0f,
0.075f,
0.246f,
0.114f,
0.717f,
0.314f,
0.296f,
0.439f,
0.114f,
0.257f,
0.107f,
0.153f,
0.0535f,
0.071f,
0.089f,
0.035f,
0.0214f,
0.0214f
};
static const float out4[]=
{
1.0f,
0.221f,
0.9f,
0.314f,
0.317f,
0.117f,
0.221f,
0.196f,
0.264f,
0.0535f,
0.089f,
0.0321f,
0.075f,
0.067f,
0.0642f,
0.021f,
0.021f,
0.014f
};
static const float in5[]=
{
1.0f,
0.103f,
0.292f,
0.478f,
0.375f,
0.0964f,
0.207f,
0.114f,
0.246f,
0.02f,
0.103f,
0.078f,
0.075f,
0.01f,
0.04f
};
static const float out5[]=
{
1.0f,
0.025f,
0.446f,
0.31f,
0.046f,
0.217f,
0.167f,
0.042f,
0.167f,
0.014f,
0.035f,
0.035f,
0.01f,
0.015f,
0.01f
};
static const float in6[]=
{
1.0f,
0.03f,
0.28f,
0.135f,
0.139f,
0.0535f,
0.192f,
0.046f,
0.042f,
0.035f,
0.025f,
0.014f
};
static const float out6[]=
{
1.0f,
0.146f,
0.242f,
0.06f,
0.025f,
0.107f,
0.064f,
0.025f,
0.05f,
0.01f
};
static const float in7[]=
{
0.63f,
0.17f,
0.58f,
1.0f,
0.2f,
0.26f,
0.039f,
0.035f,
0.039f,
0.035f
};
static const float out7[]=
{
1.0f,
0.91f,
0.98f,
0.15f,
0.18f,
0.08f,
0.01f,
0.132f
};
static const float in8[]=
{
1.0f,
0.89f,
0.732f,
0.06f,
0.314f,
0.139f,
0.039f,
0.028f,
0.028f
};
static const float out8[]=
{
1.0f,
0.43f,
0.564f,
0.182f,
0.0785f,
0.075f,
0.31f,
0.057f,
0.021f,
0.021f
};
static const float in9[]=
{
1.0f,
0.092f,
0.16f,
0.05f,
0.139f
};
static const float out9[]=
{
1.0f,
0.796f,
0.067f,
0.096f,
0.139f,
0.0821f,
0.021f
};
static const float in10[]=
{
1.0f,
0.15f,
0.24f,
0.017f,
};
static const float out10[]=
{
1.0f,
0.078f,
0.214f,
0.107f,
0.042f,
};
static const float* notes_specturm_table[]=
{
in1, out1,
in2, out2,
in3, out3,
in4, out4,
in5, out5,
in6, out6,
in7, out7,
in8, out8,
in9, out9,
in10, out10,
};
const unsigned int notes_spectrum_size_table[]=
{
sizeof(in1)/sizeof(float), sizeof(out1)/sizeof(float),
sizeof(in2)/sizeof(float), sizeof(out2)/sizeof(float),
sizeof(in3)/sizeof(float), sizeof(out3)/sizeof(float),
sizeof(in4)/sizeof(float), sizeof(out4)/sizeof(float),
sizeof(in5)/sizeof(float), sizeof(out5)/sizeof(float),
sizeof(in6)/sizeof(float), sizeof(out6)/sizeof(float),
sizeof(in7)/sizeof(float), sizeof(out7)/sizeof(float),
sizeof(in8)/sizeof(float), sizeof(out8)/sizeof(float),
sizeof(in9)/sizeof(float), sizeof(out9)/sizeof(float),
sizeof(in10)/sizeof(float), sizeof(out10)/sizeof(float),
};
static const float notes_freq_base_table[]=
{
261.63f, 293.66f, // 1C 1D
329.63f, 392.0f, // 1E 1G
392.0f , 493.88f, // 1G 1B
523.25f, 587.33f, // 2C 2D
659.26f, 698.46f, // 2E 2F
783.99f, 880.00f, // 2G 2A
1046.5f, 987.77f, // 3C 2B
1318.5f, 1174.7f, // 3E 3D
1568.0f, 1396.9f , // 3G 3F
2093.0f, 1760.0f , // 4C 3A
};
|
mfkiwl/Clarinet-riscv
|
applications/lib/clarinet.c
|
#include <stdio.h>
#include <math.h>
#include "clarinet.h"
// For a detailed explainer of inline assembler, the following resource is excellent:
// http://www.ethernut.de/en/documents/arm-inline-asm.html
// --------
// FMA macros
// the _p_ indicates that the input values are posit type
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fma (unsigned char a, unsigned char b) {
#endif
#ifdef PWIDTH_16
void fn_posit_p_fma (unsigned short a, unsigned short b) {
#endif
#ifdef PWIDTH_24
void fn_posit_p_fma (unsigned int a, unsigned int b) {
#endif
#ifdef PWIDTH_32
void fn_posit_p_fma (unsigned int a, unsigned int b) {
#endif
asm (
"pmv.w.x fa4, %[inA]\n"
"pmv.w.x fa5, %[inB]\n"
"fma.p ft0, fa4, fa5"
:
: [inA] "r" (a), [inB] "r" (b) /* GPR registers */
: "ft0", "fa4", "fa5" /* clobber list */
);
return;
}
#endif
void fn_posit_fma (float a, float b) {
asm (
"fcvt.p.s ft0, %[inA]\n"
"fcvt.p.s ft1, %[inB]\n"
"fma.p ft0, ft0, ft1"
:
: [inA] "f" (a), [inB] "f" (b)
: "ft0", "ft1"
);
return;
}
#ifdef DOUBLE
double fn_double_fma (double a, double b, double acc) {
double res;
asm ( "fmadd.d %[o_acc], %[i_a], %[i_b], %[i_acc]"
#else
float fn_float_fma (float a, float b, float acc) {
float res;
asm ( "fmadd.s %[o_acc], %[i_a], %[i_b], %[i_acc]"
#endif
: [o_acc] "=f" (res)
: [i_a] "f" (a), [i_b] "f" (b), [i_acc] "f" (acc)
:
);
return (res);
}
// --------
// FMS macros
// the _p_ indicates that the input values are posit type
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fms (unsigned char a, unsigned char b) {
#endif
#ifdef PWIDTH_16
void fn_posit_p_fms (unsigned short a, unsigned short b) {
#endif
#ifdef PWIDTH_24
void fn_posit_p_fms (unsigned int a, unsigned int b) {
#endif
#ifdef PWIDTH_32
void fn_posit_p_fms (unsigned int a, unsigned int b) {
#endif
asm (
"pmv.w.x fa4, %[inA]\n"
"pmv.w.x fa5, %[inB]\n"
"fms.p ft0, fa4, fa5"
:
: [inA] "r" (a), [inB] "r" (b) /* GPR registers */
: "ft0", "fa4", "fa5" /* clobber list */
);
return;
}
#endif
void fn_posit_fms (float a, float b) {
asm (
"fcvt.p.s ft0, %[inA]\n"
"fcvt.p.s ft1, %[inB]\n"
"fms.p ft0, ft0, ft1"
:
: [inA] "f" (a), [inB] "f" (b)
: "ft0", "ft1"
);
return;
}
// --------
// FDA macros
// the _p_ indicates that the input values are posit type
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fda (unsigned char a, unsigned char b) {
#endif
#ifdef PWIDTH_16
void fn_posit_p_fda (unsigned short a, unsigned short b) {
#endif
#ifdef PWIDTH_24
void fn_posit_p_fda (unsigned int a, unsigned int b) {
#endif
#ifdef PWIDTH_32
void fn_posit_p_fda (unsigned int a, unsigned int b) {
#endif
asm (
"pmv.w.x fa4, %[inA]\n"
"pmv.w.x fa5, %[inB]\n"
"fda.p ft0, fa4, fa5"
:
: [inA] "r" (a), [inB] "r" (b) /* GPR registers */
: "ft0", "fa4", "fa5" /* clobber list */
);
return;
}
#endif
void fn_posit_fda (float a, float b) {
asm (
"fcvt.p.s ft0, %[inA]\n"
"fcvt.p.s ft1, %[inB]\n"
"fda.p ft0, ft0, ft1"
:
: [inA] "f" (a), [inB] "f" (b)
: "ft0", "ft1"
);
return;
}
// --------
// FDS macros
// the _p_ indicates that the input values are posit type
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fds (unsigned char a, unsigned char b) {
#endif
#ifdef PWIDTH_16
void fn_posit_p_fds (unsigned short a, unsigned short b) {
#endif
#ifdef PWIDTH_24
void fn_posit_p_fds (unsigned int a, unsigned int b) {
#endif
#ifdef PWIDTH_32
void fn_posit_p_fds (unsigned int a, unsigned int b) {
#endif
asm (
"pmv.w.x fa4, %[inA]\n"
"pmv.w.x fa5, %[inB]\n"
"fds.p ft0, fa4, fa5"
:
: [inA] "r" (a), [inB] "r" (b) /* GPR registers */
: "ft0", "fa4", "fa5" /* clobber list */
);
return;
}
#endif
void fn_posit_fds (float a, float b) {
asm (
"fcvt.p.s ft0, %[inA]\n"
"fcvt.p.s ft1, %[inB]\n"
"fds.p ft0, ft0, ft1"
:
: [inA] "f" (a), [inB] "f" (b)
: "ft0", "ft1"
);
return;
}
// Using the math sqrt does not seem to infer fsqrt.s instruction.
// This function explicitly uses the fsqrt instruction
#ifdef DOUBLE
double fn_double_sqrt (double a) {
double res;
asm ( "fsqrt.d %[o_res], %[i_a]"
#else
float fn_float_sqrt (float a) {
float res;
asm ( "fsqrt.s %[o_res], %[i_a]"
#endif
: [o_res] "=f" (res)
: [i_a] "f" (a)
:
);
return (res);
}
// --------
// Quire initialization macros
// the _p_ indicates that the input values are posit type
#ifdef PWIDTH_8
void fn_init_p_quire (unsigned char initVal) {
#endif
#ifdef PWIDTH_16
void fn_init_p_quire (unsigned short initVal) {
#endif
#ifdef PWIDTH_24
void fn_init_p_quire (unsigned int initVal) {
#endif
#ifdef PWIDTH_32
void fn_init_p_quire (unsigned int initVal) {
#endif
asm (
"pmv.w.x fa4, %[inA]\n"
"fcvt.r.p ft0, fa4"
:
: [inA] "r" (initVal)
: "fa4"
);
return;
}
void fn_init_quire (float initVal) {
asm (
"fcvt.p.s ft1, %[inA]\n"
"fcvt.r.p ft0, ft1"
:
: [inA] "f" (initVal)
: "ft1"
);
return;
}
// --------
// Quire read macros
// Read the quire and return the appropriately sized posit
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_read_p_quire (void) {
unsigned char res;
#endif
#ifdef PWIDTH_16
unsigned short fn_read_p_quire (void) {
unsigned short res;
#endif
#ifdef PWIDTH_24
unsigned int fn_read_p_quire (void) {
unsigned int res;
#endif
#ifdef PWIDTH_32
unsigned int fn_read_p_quire (void) {
unsigned int res;
#endif
asm ( "fcvt.p.r ft0, ft0 \n"
"pmv.x.w %[o_res], ft0"
: [o_res] "=r" (res)
:
: "ft0"
);
return (res);
}
#endif
// Read the quire and return a float
float fn_read_quire (void) {
float res;
asm ( "fcvt.p.r ft0, ft0 \n"
"fcvt.s.p %[o_res], ft0"
: [o_res] "=f" (res)
:
: "ft0"
);
return (res);
}
// --------
// Float to Posit conversion
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_float_to_posit (float a) {
unsigned char res;
#endif
#ifdef PWIDTH_16
unsigned short fn_float_to_posit (float a) {
unsigned short res;
#endif
#ifdef PWIDTH_24
unsigned int fn_float_to_posit (float a) {
unsigned int res;
#endif
#ifdef PWIDTH_32
unsigned int fn_float_to_posit (float a) {
unsigned int res;
#endif
asm ( "fcvt.p.s ft0, %[i_a]\n"
"pmv.x.w %[o_res], ft0"
: [o_res] "=r" (res)
: [i_a] "f" (a)
: "ft0"
);
return (res);
}
#endif
// --------
// VDP Routines
// Posit input, posit compute, posit output
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_posit_p_vdp (int r, unsigned char p_a[], unsigned char p_b[]) {
unsigned char acc;
#endif
#ifdef PWIDTH_16
unsigned short fn_posit_p_vdp (int r, unsigned short p_a[], unsigned short p_b[]) {
unsigned short acc;
#endif
#ifdef PWIDTH_24
unsigned int fn_posit_p_vdp (int r, unsigned char p_aH[], unsigned short p_aL[], unsigned char p_bH[], unsigned short p_bL[]) {
unsigned int acc;
#endif
#ifdef PWIDTH_32
unsigned int fn_posit_p_vdp (int r, unsigned int p_a[], unsigned int p_b[]) {
unsigned int acc;
#endif
int idx = 0; int rep = 0;
fn_init_p_quire (0);
for (idx=0; idx < r; idx ++) {
#ifdef PWIDTH_24
fn_posit_p_fma (
(unsigned int) (p_aL[idx] | (p_aH[idx] << 16))
, (unsigned int) (p_bL[idx] | (p_bH[idx] << 16)));
#else
fn_posit_p_fma (p_a[idx], p_b[idx]);
#endif
}
acc = fn_read_p_quire ();
return (acc);
}
#endif
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_gemv (unsigned char v_acc[], int r, unsigned char m_a[][VSZ], unsigned char p_b[]) {
#endif
#ifdef PWIDTH_16
void fn_posit_p_gemv (unsigned short v_acc[], int r, unsigned short m_a[][VSZ], unsigned short p_b[]) {
#endif
#ifdef PWIDTH_24
void fn_posit_p_gemv (unsigned int v_acc[], int r, unsigned char m_aH[][VSZ], unsigned short m_a[][VSZ], unsigned char p_bH[], unsigned short p_b[]) {
#endif
#ifdef PWIDTH_32
void fn_posit_p_gemv (unsigned int v_acc[], int r, unsigned int m_a[][VSZ], unsigned int p_b[]) {
#endif
int idx = 0;
for (idx=0; idx < r; idx ++)
#ifdef PWIDTH_24
v_acc[idx] = fn_posit_p_vdp (r, m_aH[idx], m_a[idx], p_bH, p_b);
#else
v_acc[idx] = fn_posit_p_vdp (r, m_a[idx], p_b);
#endif
return;
}
#endif
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_gemm (unsigned char m_acc[][VSZ], int dimension, unsigned char m_a[][VSZ], unsigned char m_b[][VSZ]) {
unsigned char v_acc[VSZ];
#endif
#ifdef PWIDTH_16
void fn_posit_p_gemm (unsigned short m_acc[][VSZ], int dimension, unsigned short m_a[][VSZ], unsigned short m_b[][VSZ]) {
unsigned short v_acc[VSZ];
#endif
#ifdef PWIDTH_24
void fn_posit_p_gemm (unsigned int m_acc[][VSZ], int dimension, unsigned char m_aH[][VSZ], unsigned short m_a[][VSZ], unsigned char m_bH[][VSZ], unsigned short m_b[][VSZ]) {
unsigned int v_acc[VSZ];
#endif
#ifdef PWIDTH_32
void fn_posit_p_gemm (unsigned int m_acc[][VSZ], int dimension, unsigned int m_a[][VSZ], unsigned int m_b[][VSZ]) {
unsigned int v_acc[VSZ];
#endif
int ridx = 0; int cidx = 0;
for (ridx=0; ridx < dimension; ridx++) {
#ifdef PWIDTH_24
fn_posit_p_gemv (v_acc, dimension, m_aH, m_a, m_bH[ridx], m_b[ridx]);
#else
fn_posit_p_gemv (v_acc, dimension, m_a, m_b[ridx]);
#endif
// implement a transpose to get the result matrix
for (cidx=0; cidx < dimension; cidx++) {
m_acc[cidx][ridx] = v_acc[cidx];
}
}
return;
}
#endif
// Float input, posit compute, float output
float fn_posit_vdp (int r, float v_a[], float v_b[]) {
float acc;
int idx = 0;
fn_init_p_quire (0);
for (idx=0; idx < r; idx ++) fn_posit_fma (v_a[idx], v_b[idx]);
acc = fn_read_quire ();
return (acc);
}
// Float input, posit compute, float output
void fn_posit_gemv (float v_acc[], int r, float m_a[][VSZ], float v_b[]) {
int idx = 0;
for (idx=0; idx < r; idx ++) v_acc[idx] = fn_posit_vdp (r, m_a[idx], v_b);
return;
}
// Float input, float compute, float output. Code written to allow compiler optimization wrt
// function calls.
void fn_posit_gemm (float m_acc[][VSZ], int dimension, float m_a[][VSZ], float m_b[][VSZ]) {
int ridx = 0; int cidx = 0;
float v_acc[VSZ];
for (ridx=0; ridx < dimension; ridx++) {
fn_posit_gemv (v_acc, dimension, m_a, m_b[ridx]);
// implement a transpose to get the result matrix
for (cidx=0; cidx < dimension; cidx++) {
m_acc[cidx][ridx] = v_acc[cidx];
}
}
return;
}
#ifdef DOUBLE
double fn_double_vdp (int r, double v_a[], double v_b[]) {
double acc = 0.0;
#else
float fn_float_vdp (int r, float v_a[], float v_b[]) {
float acc = 0.0;
#endif
int idx = 0;
for (idx=0; idx < r; idx ++)
#ifdef FMADD_ENABLED
#ifdef DOUBLE
acc = fn_double_fma (v_a[idx], v_b[idx], acc);
#else
acc = fn_float_fma (v_a[idx], v_b[idx], acc);
#endif
#else
acc += (v_a[idx] * v_b[idx]);
#endif
return (acc);
}
#ifdef DOUBLE
// Double input, double compute, double output
void fn_double_gemv (double v_acc[], int r, double m_a[][VSZ], double v_b[]) {
int idx = 0;
for (idx=0; idx < r; idx ++)
v_acc[idx] = fn_double_vdp (r, m_a[idx], v_b);
return;
}
#else
// Float input, float compute, float output
void fn_float_gemv (float v_acc[], int r, float m_a[][VSZ], float v_b[]) {
int idx = 0;
for (idx=0; idx < r; idx ++)
v_acc[idx] = fn_float_vdp (r, m_a[idx], v_b);
return;
}
#endif
#ifdef DOUBLE
// double input, double compute, double output. The second matrix is the transposed version
void fn_double_gemm (double m_acc[][VSZ], int dimension, double m_a[][VSZ], double m_b[][VSZ]) {
int ridx = 0; int cidx = 0;
double v_acc[VSZ];
for (ridx=0; ridx < dimension; ridx++) {
fn_double_gemv (v_acc, dimension, m_a, m_b[ridx]);
// implement a transpose to get the result matrix
for (cidx=0; cidx < dimension; cidx++) {
m_acc[cidx][ridx] = v_acc[cidx];
}
}
return;
}
#else
// Float input, float compute, float output. The second matrix is the transposed version
void fn_float_gemm (float m_acc[][VSZ], int dimension, float m_a[][VSZ], float m_b[][VSZ]) {
int ridx = 0; int cidx = 0;
float v_acc[VSZ];
for (ridx=0; ridx < dimension; ridx++) {
fn_float_gemv (v_acc, dimension, m_a, m_b[ridx]);
// implement a transpose to get the result matrix
for (cidx=0; cidx < dimension; cidx++) {
m_acc[cidx][ridx] = v_acc[cidx];
}
}
return;
}
#endif
|
mfkiwl/Clarinet-riscv
|
applications/gemm/gemm.c
|
<gh_stars>10-100
#include <stdio.h>
//for read_cycle
#include "riscv_counters.h"
// for PRIu64
#include <inttypes.h>
#include "data_gemm.h"
#include "clarinet.h"
int main (void) {
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char acc [VSZ][VSZ];
#endif
#ifdef PWIDTH_16
unsigned short acc [VSZ][VSZ];
#endif
#ifdef PWIDTH_24
unsigned int acc [VSZ][VSZ];
#endif
#ifdef PWIDTH_32
unsigned int acc [VSZ][VSZ];
#endif
#endif
#ifdef DOUBLE
#else
#endif
uint32_t start = 0;
uint32_t end = 0;
uint32_t elapsed = 0;
// Now lets do some cycle analysis
#ifdef FLOAT
float acc [VSZ][VSZ];
#ifdef WARM_CACHES
fn_float_gemm (acc, VSZ, m_a, m_b);
#endif
start=read_cycle();
fn_float_gemm (acc, VSZ, m_a, m_b);
#endif
#ifdef DOUBLE
double acc [VSZ][VSZ];
#ifdef WARM_CACHES
fn_double_gemm (acc, VSZ, m_a, m_b);
#endif
start=read_cycle();
fn_double_gemm (acc, VSZ, m_a, m_b);
#endif
#ifdef FLOAT_POSIT
float acc [VSZ][VSZ];
#ifdef WARM_CACHES
fn_posit_gemm (acc, VSZ, m_a, m_b);
#endif
start=read_cycle();
fn_posit_gemm (acc, VSZ, m_a, m_b);
#endif
#ifdef POSIT
#ifdef WARM_CACHES
#ifdef PWIDTH_24
fn_posit_p_gemm (acc, VSZ, m_aH, m_a, m_bH, m_b);
#else
fn_posit_p_gemm (acc, VSZ, m_a, m_b);
#endif
#endif
start=read_cycle();
#ifdef PWIDTH_24
fn_posit_p_gemm (acc, VSZ, m_aH, m_a, m_bH, m_b);
#else
fn_posit_p_gemm (acc, VSZ, m_a, m_b);
#endif
#endif
end=read_cycle();
elapsed = end - start;
printf ("VDP Cycle Report. Size: %d. Cycles: %d\n", VSZ, elapsed);
return (0);
}
|
mfkiwl/Clarinet-riscv
|
applications/lib/syscalls.c
|
#include <errno.h>
#include <sys/stat.h>
#include <sys/times.h>
#include <sys/time.h>
#ifndef __linux__
__attribute__ ((weak))
int _read(int file, char *ptr, int len) {
errno = ENOSYS;
return -1;
}
__attribute__ ((weak))
int _write(int file, char *ptr, int len) {
errno = ENOSYS;
return -1;
}
#define CLOCK_PERIOD (100000000)
int gettimeofday(struct timeval *ptimeval, void *ptimezone) {
if (ptimeval) {
long long tv;
#if __riscv_xlen == 64
asm ("rdtime %0" : "=r" (tv));
#else
unsigned int tvh;
unsigned int tvl;
asm ("rdtime %0;"
"rdtimeh %1 " : "=r" (tvl), "=r" (tvh));
tv = ((long long)tvh) << 32 | tvl;
#endif
ptimeval->tv_sec = tv / CLOCK_PERIOD;
ptimeval->tv_usec = tv % CLOCK_PERIOD / (CLOCK_PERIOD / 1000000);
}
return 0;
}
unsigned int sleep(unsigned int seconds) {
struct timeval tv;
gettimeofday(&tv, NULL);
seconds += tv.tv_sec;
while (tv.tv_sec < seconds)
gettimeofday(&tv, NULL);
return 0;
}
void *_sbrk (int nbytes) {
errno = ENOMEM;
return (void *)-1;
}
int _close(int fd) {
errno = ENOSYS;
return -1;
}
long _lseek(int fd, long offset, int origin ) {
errno = ENOSYS;
return -1;
}
int _fstat(int fd, struct stat *buffer) {
errno = ENOSYS;
return -1;
}
int _isatty(int fd) {
errno = ENOSYS;
return 0;
}
/* Use the "tohost" test-exit signal to end the program */
void exit_via_tohost(void) __attribute__ ((destructor));
void exit_via_tohost(void)
{
asm volatile ("li a0, 0x1;"
"sw a0, tohost, t0");
}
#endif
|
mfkiwl/Clarinet-riscv
|
applications/vdp/vdp.c
|
<filename>applications/vdp/vdp.c
#include <stdio.h>
//for read_cycle
#include "riscv_counters.h"
// for PRIu64
#include <inttypes.h>
#include "clarinet.h"
#include "data_vdp.h"
int main (void) {
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char acc;
#endif
#ifdef PWIDTH_16
unsigned short acc;
#endif
#ifdef PWIDTH_24
unsigned int acc;
#endif
#ifdef PWIDTH_32
unsigned int acc;
#endif
#endif
uint32_t start = 0;
uint32_t end = 0;
uint32_t elapsed = 0;
// Basic VDPs are working
// Now lets do some cycle analysis
#ifdef FLOAT
float acc;
#ifdef WARM_CACHES
acc = fn_float_vdp (VSZ, v_a, v_b);
#endif
start=read_cycle();
acc = fn_float_vdp (VSZ, v_a, v_b);
end=read_cycle();
#endif
#ifdef FLOAT_POSIT
float acc;
#ifdef WARM_CACHES // run once to warm up caches
acc = fn_posit_vdp (VSZ, v_a, v_b);
#endif
start=read_cycle();
acc = fn_posit_vdp (VSZ, v_a, v_b);
end=read_cycle();
#endif
#ifdef DOUBLE
double acc;
#ifdef WARM_CACHES // run once to warm up caches
acc = fn_double_vdp (VSZ, v_a, v_b);
#endif
start=read_cycle();
acc = fn_double_vdp (VSZ, v_a, v_b);
end=read_cycle();
#endif
#ifdef POSIT
#ifdef WARM_CACHES
// run once to warm up caches
#ifdef PWIDTH_24
acc = fn_posit_p_vdp (VSZ, v_aH, v_a, v_bH, v_b);
#else
acc = fn_posit_p_vdp (VSZ, v_a, v_b);
#endif
#endif
start=read_cycle();
#ifdef PWIDTH_24
acc = fn_posit_p_vdp (VSZ, v_aH, v_a, v_bH, v_b);
#else
acc = fn_posit_p_vdp (VSZ, v_a, v_b);
#endif
end=read_cycle();
#endif
elapsed = end - start;
#ifdef WARM_CACHES
printf ("VDP Cycle Report (warm caches). Size: %d. Cycles: %d\n", VSZ, elapsed);
#else
printf ("VDP Cycle Report. Size: %d. Cycles: %d\n", VSZ, elapsed);
#endif
return (0);
}
|
mfkiwl/Clarinet-riscv
|
applications/givens/givens.c
|
<filename>applications/givens/givens.c
#include <stdio.h>
//for read_cycle
#include "riscv_counters.h"
// for PRIu64
#include <inttypes.h>
#include "clarinet.h"
#include "data_givens.h"
// --------
// Givens routines
//
#ifdef DOUBLE
void fn_double_givens (int dim, double mat[][VSZ], int r, int c) {
double tmp, sine_t, cosine_t, row1[dim], row2[dim];
#else
void fn_float_givens (int dim, float mat[][VSZ], int r, int c) {
float tmp, sine_t, cosine_t, row1[dim], row2[dim];
#endif
for (int j=0; j<r-1; j++) {
for (int i=r-1; i>j; i--) {
tmp = ((mat[i][j]*mat[i][j]) + (mat[i-1][j]*mat[i-1][j]));
#ifdef DOUBLE
tmp = fn_double_sqrt (tmp);
#else
tmp = fn_float_sqrt (tmp);
#endif
sine_t = (mat[i][j])/tmp;
cosine_t = (mat[i-1][j])/tmp;
for(int k=j; k<r; k++){
row1[k] = cosine_t*mat[i-1][k] + sine_t*mat[i][k];
row2[k] = -sine_t*mat[i-1][k] + cosine_t*mat[i][k];
}
for(int k=j; k<r; k++){
mat[i-1][k] = row1[k];
mat[i][k] = row2[k];
}
}
}
}
#ifdef FLOAT_POSIT
// Float input, posit compute, float output
void fn_posit_givens (int dim, float mat[][VSZ], int r, int c) {
float tmp, sine_t, cosine_t;
float row1[dim], row2[dim];
for (int j=0; j<r-1; j++) {
for (int i=r-1; i>j; i--) {
// compute tmp
fn_init_p_quire (0);
fn_posit_fma (mat[i][j], mat[i][j]);
fn_posit_fma (mat[i-1][j], mat[i-1][j]);
tmp = fn_read_quire(); tmp = fn_float_sqrt (tmp);
// compute sine_t
fn_init_p_quire (0);
fn_posit_fda (mat[i][j], tmp);
sine_t = fn_read_quire();
// compute cosine_t
fn_init_p_quire (0);
fn_posit_fda (mat[i-1][j], tmp);
cosine_t = fn_read_quire ();
for(int k=j; k<r; k++){
// compute row1[k]
fn_init_p_quire (0);
fn_posit_fma (cosine_t, mat[i-1][k]);
fn_posit_fma (sine_t, mat[i][k]);
row1[k] = fn_read_quire ();
// compute row2[k]
fn_init_p_quire (0);
fn_posit_fma (cosine_t, mat[i][k]);
fn_posit_fms (sine_t, mat[i-1][k]);
row2[k] = fn_read_quire ();
}
for(int k=j; k<r; k++){
mat[i-1][k] = row1[k];
mat[i][k] = row2[k];
}
}
}
}
#endif
// Posit input, posit compute, posit output
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_givens (int dim, unsigned char mat[][VSZ], int r, int c) {
unsigned char sine_t, cosine_t, p_matsq;
unsigned char row1[dim], row2[dim];
#endif
#ifdef PWIDTH_16
void fn_posit_p_givens (int dim, unsigned short mat[][VSZ], int r, int c) {
unsigned short sine_t, cosine_t, p_matsq;
unsigned short row1[dim], row2[dim];
#endif
#ifdef PWIDTH_32
void fn_posit_p_givens (int dim, unsigned int mat[][VSZ], int r, int c) {
unsigned int sine_t, cosine_t, p_matsq;
unsigned int row1[dim], row2[dim];
#endif
float f_matsq;
for (int j=0; j<r-1; j++) {
for (int i=r-1; i>j; i--) {
// compute f_matsq
fn_init_p_quire (0);
fn_posit_p_fma (mat[i][j], mat[i][j]);
fn_posit_p_fma (mat[i-1][j], mat[i-1][j]);
f_matsq = fn_read_quire(); f_matsq = fn_float_sqrt (f_matsq);
p_matsq = fn_float_to_posit (f_matsq);
// compute sine_t
fn_init_p_quire (0);
fn_posit_p_fda (mat[i][j], p_matsq);
sine_t = fn_read_p_quire();
// compute cosine_t
fn_init_p_quire (0);
fn_posit_fda (mat[i-1][j], p_matsq);
cosine_t = fn_read_p_quire ();
for(int k=j; k<r; k++){
// compute row1[k]
fn_init_p_quire (0);
fn_posit_p_fma (cosine_t, mat[i-1][k]);
fn_posit_p_fma (sine_t, mat[i][k]);
row1[k] = fn_read_p_quire ();
// compute row2[k]
fn_init_p_quire (0);
fn_posit_fma (cosine_t, mat[i][k]);
fn_posit_fms (sine_t, mat[i-1][k]);
row2[k] = fn_read_p_quire ();
}
for(int k=j; k<r; k++){
mat[i-1][k] = row1[k];
mat[i][k] = row2[k];
}
}
}
}
#endif
int main (void) {
uint32_t start = 0;
uint32_t end = 0;
uint32_t elapsed = 0;
#ifdef FLOAT
#ifdef WARM_CACHES
fn_float_givens (VSZ, m_a, VSZ, VSZ);
#endif
start=read_cycle();
fn_float_givens (VSZ, m_a, VSZ, VSZ);
end=read_cycle();
#endif
#ifdef FLOAT_POSIT
#ifdef WARM_CACHES
fn_posit_givens (VSZ, m_a, VSZ, VSZ);
#endif
start=read_cycle();
fn_posit_givens (VSZ, m_a, VSZ, VSZ);
end=read_cycle();
#endif
#ifdef DOUBLE
#ifdef WARM_CACHES
fn_double_givens (VSZ, m_a, VSZ, VSZ);
#endif
start=read_cycle();
fn_double_givens (VSZ, m_a, VSZ, VSZ);
end=read_cycle();
#endif
#ifdef POSIT
#ifdef WARM_CACHES
fn_posit_p_givens (VSZ, m_a, VSZ, VSZ);
#endif
start=read_cycle();
fn_posit_p_givens (VSZ, m_a, VSZ, VSZ);
end=read_cycle();
#endif
elapsed = end - start;
#ifdef WARM_CACHES
printf ("Givens Cycle Report (warm caches). Size: %d. Cycles: %d\n", VSZ, elapsed);
#else
printf ("Givens Cycle Report. Size: %d. Cycles: %d\n", VSZ, elapsed);
#endif
return (0);
}
|
mfkiwl/Clarinet-riscv
|
applications/lib/riscv_counters.c
|
// Copyright (c) 2013 Bluespec, Inc. All Rights Reserved
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
// ----------------------------------------------------------------
// For 64-bit:
// The following are interfaces to inline RISC-V assembly instructions
// RDCYCLE
// For all of them, the result is left in v0 (= x16) per calling convention
// For 32-bit, we get cycle counter out of MCYCLE / MCYCLEH CSRs.
// ----------------------------------------------------------------
// RV32 versions
#ifdef RV32
// We use mcycle / mcycleh instead of rdcycle / rdcycleh on 32-bit
// because Rocket32 (P1) seems not to have rdcycleh
uint32_t read_cycle (void)
{
uint32_t hi, lo, tmp;
__asm__ __volatile__ (
"1:\n"
"csrr %0, mcycleh\n"
"csrr %1, mcycle\n"
"csrr %2, mcycleh\n"
"bne %0, %2, 1b"
: "=&r" (hi), "=&r" (lo), "=&r" (tmp));
// return ((uint64_t)hi << 32) | lo;
return (lo);
}
#endif
// ----------------------------------------------------------------
// RV64 versions
#ifdef RV64
uint64_t read_cycle (void)
{
uint64_t result;
asm volatile ("RDCYCLE %0" : "=r" (result));
return result;
}
#endif
// ----------------------------------------------------------------
|
mfkiwl/Clarinet-riscv
|
applications/lib/clarinet.h
|
<reponame>mfkiwl/Clarinet-riscv<gh_stars>10-100
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fma (unsigned char a, unsigned char b);
#endif
#ifdef PWIDTH_16
void fn_posit_p_fma (unsigned short a, unsigned short b);
#endif
#ifdef PWIDTH_24
void fn_posit_p_fma (unsigned int a, unsigned int b);
#endif
#ifdef PWIDTH_32
void fn_posit_p_fma (unsigned int a, unsigned int b);
#endif
#endif
void fn_posit_fma (float a, float b);
float fn_float_fma (float a, float b, float acc);
#ifdef DOUBLE
double fn_double_fma (double a, double b, double acc);
#endif
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fms (unsigned char a, unsigned char b);
#endif
#ifdef PWIDTH_16
void fn_posit_p_fms (unsigned short a, unsigned short b);
#endif
#ifdef PWIDTH_24
void fn_posit_p_fms (unsigned int a, unsigned int b);
#endif
#ifdef PWIDTH_32
void fn_posit_p_fms (unsigned int a, unsigned int b);
#endif
#endif
void fn_posit_fms (float a, float b);
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_fda (unsigned char a, unsigned char b);
#endif
#ifdef PWIDTH_16
void fn_posit_p_fda (unsigned short a, unsigned short b);
#endif
#ifdef PWIDTH_24
void fn_posit_p_fda (unsigned int a, unsigned int b);
#endif
#ifdef PWIDTH_32
void fn_posit_p_fda (unsigned int a, unsigned int b);
#endif
#endif
void fn_posit_fda (float a, float b);
// --------
float fn_float_sqrt (float a);
#ifdef DOUBLE
double fn_double_sqrt (double a);
#endif
// --------
#ifdef PWIDTH_8
void fn_init_p_quire (unsigned char initVal);
#endif
#ifdef PWIDTH_16
void fn_init_p_quire (unsigned short initVal);
#endif
#ifdef PWIDTH_24
void fn_init_p_quire (unsigned int initVal);
#endif
#ifdef PWIDTH_32
void fn_init_p_quire (unsigned int initVal);
#endif
void fn_init_quire (float initVal);
// --------
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_read_p_quire (void);
#endif
#ifdef PWIDTH_16
unsigned short fn_read_p_quire (void);
#endif
#ifdef PWIDTH_24
unsigned int fn_read_p_quire (void);
#endif
#ifdef PWIDTH_32
unsigned int fn_read_p_quire (void);
#endif
#endif
float fn_read_quire (void);
// --------
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_float_to_posit (float);
#endif
#ifdef PWIDTH_16
unsigned short fn_float_to_posit (float);
#endif
#ifdef PWIDTH_24
unsigned int fn_float_to_posit (float);
#endif
#ifdef PWIDTH_32
unsigned int fn_float_to_posit (float);
#endif
#endif
// --------
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char fn_posit_p_vdp (int r, unsigned char a[], unsigned char b[]);
#endif
#ifdef PWIDTH_16
unsigned short fn_posit_p_vdp (int r, unsigned short a[], unsigned short b[]);
#endif
#ifdef PWIDTH_24
unsigned int fn_posit_p_vdp (int r, unsigned char ah[], unsigned short al[], unsigned char bh[], unsigned short bl[]);
#endif
#ifdef PWIDTH_32
unsigned int fn_posit_p_vdp (int r, unsigned int a[], unsigned int b[]);
#endif
#endif
float fn_posit_vdp (int r, float a[], float b[]);
#ifdef DOUBLE
double fn_double_vdp (int r, double a[], double b[]);
#else
float fn_float_vdp (int r, float a[], float b[]);
#endif
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_gemv (unsigned char v_acc[], int r, unsigned char a[][VSZ], unsigned char b[]);
#endif
#ifdef PWIDTH_16
void fn_posit_p_gemv (unsigned short v_acc[], int r, unsigned short a[][VSZ], unsigned short b[]);
#endif
#ifdef PWIDTH_24
void n_posit_p_gemv (unsigned int v_acc[], int r, unsigned char aH[][VSZ], unsigned short a[][VSZ], unsigned char bH[], unsigned int b[]);
#endif
#ifdef PWIDTH_32
void n_posit_p_gemv (unsigned int v_acc[], int r, unsigned int a[][VSZ], unsigned int b[]);
#endif
#endif
void fn_posit_gemv (float v_acc[], int r, float a[][VSZ], float b[]);
#ifdef DOUBLE
void fn_double_gemv (double v_acc[], int r, double a[][VSZ], double b[]);
#else
void fn_float_gemv (float v_acc[], int r, float a[][VSZ], float b[]);
#endif
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_gemm (unsigned char m_acc[][VSZ], int r, unsigned char a[][VSZ], unsigned char b[][VSZ]);
#endif
#ifdef PWIDTH_16
void fn_posit_p_gemm (unsigned short m_acc[][VSZ], int r, unsigned short a[][VSZ], unsigned short b[][VSZ]);
#endif
#ifdef PWIDTH_24
void fn_posit_p_gemm (unsigned int m_acc[][VSZ], int r, unsigned char aH[][VSZ], unsigned short a[][VSZ], unsigned char bH[][VSZ], unsigned short b[][VSZ]);
#endif
#ifdef PWIDTH_32
void fn_posit_p_gemm (unsigned int m_acc[][VSZ], int r, unsigned int a[][VSZ], unsigned int b[][VSZ]);
#endif
#endif
void fn_posit_gemm (float m_acc[][VSZ], int r, float a[][VSZ], float b[][VSZ]);
#ifdef DOUBLE
void fn_double_gemm (double m_acc[][VSZ], int r, double a[][VSZ], double b[][VSZ]);
#else
void fn_float_gemm (float m_acc[][VSZ], int r, float a[][VSZ], float b[][VSZ]);
#endif
// --------
#ifdef POSIT
#ifdef PWIDTH_8
void fn_posit_p_givens (int dim, unsigned char mat[][VSZ], int r, int c);
#endif
#ifdef PWIDTH_16
void fn_posit_p_givens (int dim, unsigned short mat[][VSZ], int r, int c);
#endif
#ifdef PWIDTH_32
void fn_posit_p_givens (int dim, unsigned int mat[][VSZ], int r, int c);
#endif
#endif
void fn_float_givens (int dim, float mat[][VSZ], int r, int c);
void fn_posit_givens (int dim, float mat[][VSZ], int r, int c);
#ifdef DOUBLE
void fn_double_givens (int dim, double mat[][VSZ], int r, int c);
#endif
|
mfkiwl/Clarinet-riscv
|
applications/gemv/gemv.c
|
#include <stdio.h>
//for read_cycle
#include "riscv_counters.h"
// for PRIu64
#include <inttypes.h>
#include "data_gemv.h"
#include "clarinet.h"
int main (void) {
#ifdef POSIT
#ifdef PWIDTH_8
unsigned char acc [VSZ];
#endif
#ifdef PWIDTH_16
unsigned short acc [VSZ];
#endif
#ifdef PWIDTH_24
unsigned int acc [VSZ];
#endif
#ifdef PWIDTH_32
unsigned int acc [VSZ];
#endif
#endif
uint32_t start = 0;
uint32_t end = 0;
uint32_t elapsed = 0;
// Now lets do some cycle analysis
#ifdef FLOAT
float acc [VSZ];
#ifdef WARM_CACHES
fn_float_gemv (acc, VSZ, m_a, v_b);
#endif
start=read_cycle();
fn_float_gemv (acc, VSZ, m_a, v_b);
#endif
#ifdef DOUBLE
double acc [VSZ];
#ifdef WARM_CACHES
fn_double_gemv (acc, VSZ, m_a, v_b);
#endif
start=read_cycle();
fn_double_gemv (acc, VSZ, m_a, v_b);
#endif
#ifdef FLOAT_POSIT
float acc [VSZ];
#ifdef WARM_CACHES
fn_posit_gemv (acc, VSZ, m_a, v_b);
#endif
start=read_cycle();
fn_posit_gemv (acc, VSZ, m_a, v_b);
#endif
#ifdef POSIT
#ifdef WARM_CACHES
#ifdef PWIDTH_24
fn_posit_p_gemv (acc, VSZ, m_aH, m_a, v_bH, v_b);
#else
fn_posit_p_gemv (acc, VSZ, m_a, v_b);
#endif
#endif
start=read_cycle();
#ifdef PWIDTH_24
fn_posit_p_gemv (acc, VSZ, m_aH, m_a, v_bH, v_b);
#else
fn_posit_p_gemv (acc, VSZ, m_a, v_b);
#endif
#endif
end=read_cycle();
elapsed = end - start;
#ifdef WARM_CACHES
printf ("GEMV Cycle Report (warm caches). Size: %d. Cycles: %d\n", VSZ, elapsed);
#else
printf ("GEMV Cycle Report. Size: %d. Cycles: %d\n", VSZ, elapsed);
#endif
return (0);
}
|
mfkiwl/Clarinet-riscv
|
applications/lib/uart.c
|
#include <stdint.h>
#define DEFAULT_BAUDRATE (115200)
#define NS16550_BASE (0xC0000000ULL)
#define NS16550_CLOCK_RATE (1000000ULL * CLOCK_MHZ)
enum __attribute__ ((__packed__)) ier_t {
IER_ERBI = (1<<0),
IER_ETBEI = (1<<1),
IER_ELSI = (1<<2),
IER_EDSSI = (1<<3),
IER_SLEEP = (1<<4), // 16650 only
};
enum __attribute__ ((__packed__)) iir_t {
IIR_IP = 1,
IIR_NONE = 1,
IIR_RLSI = 6,
IIR_RDAI = 4,
IIR_CTOI = 0xc,
IIR_THRI = 2,
IIR_MSRI = 0,
IIR_F64E = 0x20,
IIR_FE = 0xc0,
};
enum __attribute__ ((__packed__)) fcr_t {
FCR_FE = 1,
FCR_RXFR = 2,
FCR_TXFR = 4,
FCR_DMS = 8,
FCR_F64E = 0x20,
FCR_RT1 = 0,
FCR_RT4 = 0x40,
FCR_RT8 = 0x80,
FCR_RT14 = 0xc0,
FCR_RT16 = 0x40,
FCR_RT32 = 0x80,
FCR_RT56 = 0xc0,
};
enum __attribute__ ((__packed__)) lcr_t {
LCR_WLS5 = 0,
LCR_WLS6 = 1,
LCR_WLS7 = 2,
LCR_WLS8 = 3,
LCR_STB = 4,
LCR_PEN = 8,
LCR_EPS = 0x10,
LCR_SP = 0x20,
LCR_BC = 0x40,
LCR_DLAB = 0x80,
};
enum __attribute__ ((__packed__)) mcr_t {
MCR_DTR = 1,
MCR_RTS = 2,
MCR_OUT1 = 4,
MCR_OUT2 = 8,
MCR_LOOP = 0x10,
MCR_AFE = 0x20,
};
enum __attribute__ ((__packed__)) lsr_t {
LSR_DR = 1,
LSR_OE = 2,
LSR_PE = 4,
LSR_FE = 8,
LSR_BI = 0x10,
LSR_THRE = 0x20,
LSR_TEMT = 0x40,
LSR_RXFE = 0x80,
};
enum __attribute__ ((__packed__)) msr_t {
MSR_DCTS = 1,
MSR_DDSR = 2,
MSR_TERI = 4,
MSR_DDCD = 8,
MSR_CTS = 0x10,
MSR_DSR = 0x20,
MSR_RI = 0x40,
MSR_DCD = 0x80,
};
struct __attribute__ ((aligned (4))) ns16550_pio {
// 0x000
union __attribute__ ((aligned (4))) {
const volatile uint8_t rbr;
volatile uint8_t thr;
volatile uint8_t dll;
};
// 0x008
union __attribute__ ((aligned (4))) {
volatile uint8_t dlm;
volatile enum ier_t ier;
};
// 0x010
union __attribute__ ((aligned (4))) {
const volatile enum iir_t iir;
volatile enum fcr_t fcr;
};
// 0x018
volatile enum lcr_t lcr __attribute__ ((aligned (4)));
// 0x020
volatile enum mcr_t mcr __attribute__ ((aligned (4)));
// 0x028
volatile enum lsr_t lsr __attribute__ ((aligned (4)));
// 0x030
volatile uint8_t msr __attribute__ ((aligned (4)));
// 0x038
volatile uint8_t scr __attribute__ ((aligned (4)));
};
static struct ns16550_pio * pio = (void*)NS16550_BASE;
__attribute__ ((constructor))
static int ns16550_init(void) {
uint32_t divisor;
pio->ier = 0;
divisor = NS16550_CLOCK_RATE / (16 * DEFAULT_BAUDRATE);
pio->lcr |= LCR_DLAB;
pio->dll = divisor & 0xff;
pio->dlm = (divisor >> 8) & 0xff;
pio->lcr &= ~LCR_DLAB;
pio->lcr = LCR_WLS8;
pio->fcr = FCR_FE;
pio->mcr = MCR_RTS;
return 0;
}
int ns16550_rxready(void) {
return ((pio->lsr & LSR_DR) != 0);
}
int ns16550_rxchar(void) {
while ((pio->lsr & LSR_DR) == 0)
; // nothing
return pio->rbr;
}
int ns16550_txchar(int c) {
while ((pio->lsr & LSR_THRE) == 0)
; // nothing
pio->thr = c;
return c;
}
void ns16550_flush(void) {
while ((pio->lsr & LSR_TEMT) == 0)
; // nothing
}
int _read(int file, char *ptr, int len) {
int count = 0;
while (ns16550_rxready() && (count < len)) {
*ptr++ = ns16550_rxchar();
count++;
}
return count;
}
int _write(int file, char *ptr, int len) {
int todo;
for (todo = 0; todo < len; todo++) {
ns16550_txchar (*ptr++);
}
return len;
}
|
mfkiwl/Clarinet-riscv
|
applications/lib/riscv_counters.h
|
<filename>applications/lib/riscv_counters.h
// Copyright (c) 2013 Bluespec, Inc. All Rights Reserved
#pragma once
// ----------------------------------------------------------------
// For 64-bit:
// The following are interfaces to inline RISC-V assembly instructions
// RDCYCLE
// For all of them, the result is left in v0 (= x16) per calling convention
// For 32-bit, we get cycle counter out of MCYCLE / MCYCLEH CSRs,
// because some processors, e.g., Rocket32p, do not implement
// RDCYCLEH.
#ifdef RV32
extern uint32_t read_cycle (void); // RDCYCLE
#endif
#ifdef RV64
extern uint64_t read_cycle (void); // RDCYCLE
#endif
|
mfkiwl/Clarinet-riscv
|
applications/Optical-Flow/lucaskanade_f32.c
|
<reponame>mfkiwl/Clarinet-riscv<filename>applications/Optical-Flow/lucaskanade_f32.c
#include <stdio.h>
#include <inttypes.h>
#include "img_rubik.h"
// #include "img_sphere.h"
#include "clarinet.h"
#include "riscv_counters.h"
// int X,Y;
int normalise = 0;
void getPOI(int kernelSize, int POI[][1][2])
{
int count = 0;
int mean = kernelSize/2;
int xPos = mean;
int yPos = mean;
int xStep = (X-mean)/kernelSize;
int yStep = (Y-mean)/kernelSize;
for (int i=0; i<yStep; i++)
{
for (int j=0; j<xStep; j++)
{
POI[count][0][1] = xPos;
POI[count][0][0] = yPos;
xPos += kernelSize;
count++;
}
xPos = mean;
yPos += kernelSize;
}
}
void buildA (unsigned char img[Y][X], int centerX, int centerY, int kernelSize, float A[][2])
{
int mean = kernelSize/2;
int count = 0;
unsigned char home = img[centerY][centerX];
float Ax, Ay;
for (int j = -mean; j<mean + 1; j++)
{
for (int i = -mean; i<mean + 1; i++)
{
if (i == 0) Ax = 0.0;
else Ax = (float)(home - img[centerY + j][centerX + i])/(float)i;
if (j == 0) Ay = 0.0;
else Ay = (float)(home - img[centerY + j][centerX + i])/(float)j;
A[count][0] = Ay;
A[count][1] = Ax;
count++;
}
}
}
void buildB (
unsigned char imgNew[Y][X]
, unsigned char imgOld[Y][X]
, int centerX
, int centerY
, int kernelSize
, float B[]
) {
int mean = kernelSize/2;
int count = 0;
for (int j = -mean; j < mean + 1; j++)
{
for (int i = -mean; i < mean + 1; i++)
{
B[count] = (float)(imgNew[centerY + j][centerX + i] - imgOld[centerY + j][centerX + i]);
count++;
}
}
}
void calcV(float A[][2], float B[], float V[][2], int kernelSize, int i)
{
int Arows = kernelSize * kernelSize;
/********************/
float AtA_f[2][2];
for (int row = 0; row < 2; row++) {
for (int col = 0; col < 2; col++) {
AtA_f[row][col] = 0.0;
for (int k=0; k<Arows; k++) {
// AtA_f[row][col] += fn_float_fma (A[k][row], A[k][col], AtA_f[row][col]);
AtA_f[row][col] += (A[k][row] * A[k][col]);
}
}
}
float AtB[2][1];
for (int row = 0; row < 2; row++) {
for (int col = 0; col < 1; col++) {
AtB[row][col] = 0.0;
for (int k=0; k<Arows; k++) {
// AtB[row][col] += fn_float_fma (A[k][row],B[k], AtB[row][col]);
AtB[row][col] += (A[k][row] * B[k]);
}
}
}
/********************/
float AtAInv[2][2];
float Vpt[2][1];
// Find inverse of AtA
float det = (AtA_f[0][0]*AtA_f[1][1])-(AtA_f[0][1]*AtA_f[1][0]);
if ((det) != 0) {
AtAInv[0][0] = (AtA_f[1][1]/det);
AtAInv[0][1] = (-AtA_f[0][1]/det);
AtAInv[1][0] = (-AtA_f[1][0]/det);
AtAInv[1][1] = (AtA_f[0][0]/det);
for (int row = 0; row < 2; row++) {
for (int col = 0; col < 1; col++) {
Vpt[row][col] = 0.0;
for (int k=0; k<2; k++) {
Vpt[row][col] += (AtAInv[row][k] * AtB[k][col]);
}
}
}
V[i][0] = (Vpt[0][0]);
V[i][1] = (Vpt[0][1]);
}
else {
V[i][0] = 0.0; V[i][1] = 0.0;
}
}
int main() {
int kernelSize = 5;
int length = ((X-(kernelSize/2))/kernelSize) * ((Y-(kernelSize/2))/kernelSize);
int POI[length][1][2];
getPOI(kernelSize, POI);
printf ("GetPOI complete.\n");
float V[length][2];
float A[kernelSize*kernelSize][2];
float B[kernelSize*kernelSize];
uint32_t end = 0;
uint32_t start = 0;
uint32_t avg_cycles = 0;
printf ("Processing start. X: %d, Y: %d, image count: %d, length: %d \n", X, Y, fileCount, length);
for (int fCount=1; fCount<fileCount; fCount++) {
// printf ("Processing images I%d and I%d ...\n", (fCount-1), fCount);
// Instead of moving Iold and Inew around (lots of data movement),
// depending on the fCount iteration, use the appropriate images.
for (int i=0; i<length; i++) {
if (fCount == 1) {
buildA(I1, POI[i][0][1], POI[i][0][0], kernelSize, A);
buildB(I1, I0, POI[i][0][1], POI[i][0][0], kernelSize, B);
start = read_cycle();
calcV(A, B, V, kernelSize, i);
end = read_cycle();
avg_cycles += (end - start);
} else if (fCount == 2) {
buildA(I2, POI[i][0][1], POI[i][0][0], kernelSize, A);
buildB(I2, I1, POI[i][0][1], POI[i][0][0], kernelSize, B);
calcV(A, B, V, kernelSize, i);
} else if (fCount == 3) {
buildA(I3, POI[i][0][1], POI[i][0][0], kernelSize, A);
buildB(I3, I2, POI[i][0][1], POI[i][0][0], kernelSize, B);
calcV(A, B, V, kernelSize, i);
}
}
}
avg_cycles = avg_cycles/length;
printf ("Cycles per iteration: Velocity computation: %d cycles.\n", avg_cycles);
return 0;
}
|
mfkiwl/Clarinet-riscv
|
applications/lib/main.c
|
#include <stdio.h>
//for read_cycle
#include "riscv_counters.h"
// for PRIu64
#include <inttypes.h>
int main (int argc, char ** argv)
{
uint64_t start=read_cycle();
printf("Hello World!\n");
uint64_t end=read_cycle();
printf("read_cycle: %" PRIu64 " cycles have elapsed.\n",end-start);
return 0;
}
|
liimur/IRCClientiOS
|
External/libircclient/src/utils.c
|
<reponame>liimur/IRCClientiOS
/*
* Copyright (C) 2004-2009 <NAME> <EMAIL>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
static void libirc_add_to_set (int fd, fd_set *set, int * maxfd)
{
FD_SET (fd, set);
if ( *maxfd < fd )
*maxfd = fd;
}
#if defined (ENABLE_DEBUG)
static void libirc_dump_data (const char * prefix, const char * buf, unsigned int length)
{
printf ("%s: ", prefix);
for ( ; length > 0; length -- )
printf ("%c", *buf++);
}
#endif
/*
* Finds a separator (\x0D\x0A), which separates two lines.
*/
static int libirc_findcrlf (const char * buf, int length)
{
int offset = 0;
for ( ; offset < (length - 1); offset++ )
if ( buf[offset] == 0x0D && buf[offset+1] == 0x0A )
return (offset + 2);
return 0;
}
static int libirc_findcrorlf (char * buf, int length)
{
int offset = 0;
for ( ; offset < length; offset++ )
{
if ( buf[offset] == 0x0D || buf[offset] == 0x0A )
{
buf[offset++] = '\0';
if ( offset < (length - 1)
&& (buf[offset] == 0x0D || buf[offset] == 0x0A) )
offset++;
return offset;
}
}
return 0;
}
static void libirc_event_ctcp_internal (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
{
if ( origin )
{
char nickbuf[128], textbuf[256];
irc_target_get_nick (origin, nickbuf, sizeof(nickbuf));
if ( strstr (params[0], "PING") == params[0] )
irc_cmd_ctcp_reply (session, nickbuf, params[0]);
else if ( !strcmp (params[0], "VERSION") )
{
unsigned int high, low;
irc_get_version (&high, &low);
sprintf (textbuf, "VERSION libirc by <NAME> ver.%d.%d", high, low);
irc_cmd_ctcp_reply (session, nickbuf, textbuf);
}
else if ( !strcmp (params[0], "FINGER") )
{
sprintf (textbuf, "FINGER %s (%s) Idle 0 seconds",
session->username ? session->username : "nobody",
session->realname ? session->realname : "noname");
irc_cmd_ctcp_reply (session, nickbuf, textbuf);
}
else if ( !strcmp (params[0], "TIME") )
{
time_t now = time(0);
#if defined (ENABLE_THREADS) && defined (HAVE_LOCALTIME_R)
struct tm tmtmp, *ltime = localtime_r (&now, &tmtmp);
#else
struct tm * ltime = localtime (&now);
#endif
strftime (textbuf, sizeof(textbuf), "%a %b %e %H:%M:%S %Z %Y", ltime);
irc_cmd_ctcp_reply (session, nickbuf, textbuf);
}
}
}
|
liimur/IRCClientiOS
|
External/libircclient/src/dcc.c
|
<reponame>liimur/IRCClientiOS
/*
* Copyright (C) 2004-2009 <NAME> <EMAIL>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
#define LIBIRC_DCC_CHAT 1
#define LIBIRC_DCC_SENDFILE 2
#define LIBIRC_DCC_RECVFILE 3
static irc_dcc_session_t * libirc_find_dcc_session (irc_session_t * session, irc_dcc_t dccid, int lock_list)
{
irc_dcc_session_t * s, *found = 0;
if ( lock_list )
libirc_mutex_lock (&session->mutex_dcc);
for ( s = session->dcc_sessions; s; s = s->next )
{
if ( s->id == dccid )
{
found = s;
break;
}
}
if ( found == 0 && lock_list )
libirc_mutex_unlock (&session->mutex_dcc);
return found;
}
static void libirc_dcc_destroy_nolock (irc_session_t * session, irc_dcc_t dccid)
{
irc_dcc_session_t * dcc = libirc_find_dcc_session (session, dccid, 0);
if ( dcc )
{
if ( dcc->sock >= 0 )
socket_close (&dcc->sock);
dcc->state = LIBIRC_STATE_REMOVED;
}
}
static void libirc_remove_dcc_session (irc_session_t * session, irc_dcc_session_t * dcc, int lock_list)
{
if ( dcc->sock >= 0 )
socket_close (&dcc->sock);
if ( dcc->dccsend_file_fp )
fclose (dcc->dccsend_file_fp);
dcc->dccsend_file_fp = 0;
libirc_mutex_destroy (&dcc->mutex_outbuf);
if ( lock_list )
libirc_mutex_lock (&session->mutex_dcc);
if ( session->dcc_sessions != dcc )
{
irc_dcc_session_t * s;
for ( s = session->dcc_sessions; s; s = s->next )
{
if ( s->next == dcc )
{
s->next = dcc->next;
break;
}
}
}
else
session->dcc_sessions = dcc->next;
if ( lock_list )
libirc_mutex_unlock (&session->mutex_dcc);
free (dcc);
}
static void libirc_dcc_add_descriptors (irc_session_t * ircsession, fd_set *in_set, fd_set *out_set, int * maxfd)
{
irc_dcc_session_t * dcc, *dcc_next;
time_t now = time (0);
libirc_mutex_lock (&ircsession->mutex_dcc);
// Preprocessing DCC list:
// - ask DCC send callbacks for data;
// - remove unused DCC structures
for ( dcc = ircsession->dcc_sessions; dcc; dcc = dcc_next )
{
dcc_next = dcc->next;
// Remove timed-out sessions
if ( (dcc->state == LIBIRC_STATE_CONNECTING
|| dcc->state == LIBIRC_STATE_INIT
|| dcc->state == LIBIRC_STATE_LISTENING)
&& now - dcc->timeout > ircsession->dcc_timeout )
{
// Inform the caller about DCC timeout.
// Do not inform when state is LIBIRC_STATE_INIT - session
// was initiated from someone else, and callbacks aren't set yet.
if ( dcc->state != LIBIRC_STATE_INIT )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
if ( dcc->cb )
(*dcc->cb)(ircsession, dcc->id, LIBIRC_ERR_TIMEOUT, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
}
libirc_remove_dcc_session (ircsession, dcc, 0);
}
/*
* If we're sending file, and the output buffer is empty, we need
* to provide some data.
*/
if ( dcc->state == LIBIRC_STATE_CONNECTED
&& dcc->dccmode == LIBIRC_DCC_SENDFILE
&& dcc->dccsend_file_fp
&& dcc->outgoing_offset == 0 )
{
int len = fread (dcc->outgoing_buf, 1, sizeof (dcc->outgoing_buf), dcc->dccsend_file_fp);
if ( len <= 0 )
{
int err = (len < 0 ? LIBIRC_ERR_READ : 0);
libirc_mutex_unlock (&ircsession->mutex_dcc);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
else
dcc->outgoing_offset = len;
}
// Clean up unused sessions
if ( dcc->state == LIBIRC_STATE_REMOVED )
libirc_remove_dcc_session (ircsession, dcc, 0);
}
for ( dcc = ircsession->dcc_sessions; dcc; dcc = dcc->next )
{
switch (dcc->state)
{
case LIBIRC_STATE_LISTENING:
// While listening, only in_set descriptor should be set
libirc_add_to_set (dcc->sock, in_set, maxfd);
break;
case LIBIRC_STATE_CONNECTING:
// While connection, only out_set descriptor should be set
libirc_add_to_set (dcc->sock, out_set, maxfd);
break;
case LIBIRC_STATE_CONNECTED:
// Add input descriptor if there is space in input buffer
// and it is DCC chat (during DCC send, there is nothing to recv)
if ( dcc->incoming_offset < sizeof(dcc->incoming_buf) - 1 )
libirc_add_to_set (dcc->sock, in_set, maxfd);
// Add output descriptor if there is something in output buffer
libirc_mutex_lock (&dcc->mutex_outbuf);
if ( dcc->outgoing_offset > 0 )
libirc_add_to_set (dcc->sock, out_set, maxfd);
libirc_mutex_unlock (&dcc->mutex_outbuf);
break;
case LIBIRC_STATE_CONFIRM_SIZE:
/*
* If we're receiving file, then WE should confirm the transferred
* part (so we have to sent data). But if we're sending the file,
* then RECEIVER should confirm the packet, so we have to receive
* data.
*
* We don't need to LOCK_DCC_OUTBUF - during file transfer, buffers
* can't change asynchronously.
*/
if ( dcc->dccmode == LIBIRC_DCC_RECVFILE && dcc->outgoing_offset > 0 )
libirc_add_to_set (dcc->sock, out_set, maxfd);
if ( dcc->dccmode == LIBIRC_DCC_SENDFILE && dcc->incoming_offset < 4 )
libirc_add_to_set (dcc->sock, in_set, maxfd);
}
}
libirc_mutex_unlock (&ircsession->mutex_dcc);
}
static void libirc_dcc_process_descriptors (irc_session_t * ircsession, fd_set *in_set, fd_set *out_set)
{
irc_dcc_session_t * dcc;
/*
* We need to use such a complex scheme here, because on every callback
* a number of DCC sessions could be destroyed.
*/
libirc_mutex_lock (&ircsession->mutex_dcc);
for ( dcc = ircsession->dcc_sessions; dcc; dcc = dcc->next )
{
if ( dcc->state == LIBIRC_STATE_LISTENING
&& FD_ISSET (dcc->sock, in_set) )
{
socklen_t len = sizeof(dcc->remote_addr);
int nsock, err = 0;
// New connection is available; accept it.
if ( socket_accept (&dcc->sock, &nsock, (struct sockaddr *) &dcc->remote_addr, &len) )
err = LIBIRC_ERR_ACCEPT;
// On success, change the active socket and change the state
if ( err == 0 )
{
// close the listen socket, and replace it by a newly
// accepted
socket_close (&dcc->sock);
dcc->sock = nsock;
dcc->state = LIBIRC_STATE_CONNECTED;
}
// If this is DCC chat, inform the caller about accept()
// success or failure.
// Otherwise (DCC send) there is no reason.
if ( dcc->dccmode == LIBIRC_DCC_CHAT )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
}
if ( err )
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
if ( dcc->state == LIBIRC_STATE_CONNECTING
&& FD_ISSET (dcc->sock, out_set) )
{
// Now we have to determine whether the socket is connected
// or the connect is failed
struct sockaddr_in saddr;
socklen_t slen = sizeof(saddr);
int err = 0;
if ( getpeername (dcc->sock, (struct sockaddr*)&saddr, &slen) < 0 )
err = LIBIRC_ERR_CONNECT;
// On success, change the state
if ( err == 0 )
dcc->state = LIBIRC_STATE_CONNECTED;
// If this is DCC chat, inform the caller about connect()
// success or failure.
// Otherwise (DCC send) there is no reason.
if ( dcc->dccmode == LIBIRC_DCC_CHAT )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
}
if ( err )
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
if ( dcc->state == LIBIRC_STATE_CONNECTED
|| dcc->state == LIBIRC_STATE_CONFIRM_SIZE )
{
if ( FD_ISSET (dcc->sock, in_set) )
{
int length, offset = 0, err = 0;
unsigned int amount = sizeof (dcc->incoming_buf) - dcc->incoming_offset;
length = socket_recv (&dcc->sock, dcc->incoming_buf + dcc->incoming_offset, amount);
if ( length < 0 )
{
err = LIBIRC_ERR_READ;
}
else if ( length == 0 )
{
err = LIBIRC_ERR_CLOSED;
if ( dcc->dccsend_file_fp )
{
fclose (dcc->dccsend_file_fp);
dcc->dccsend_file_fp = 0;
}
}
else
{
dcc->incoming_offset += length;
if ( dcc->dccmode != LIBIRC_DCC_CHAT )
offset = dcc->incoming_offset;
else
offset = libirc_findcrorlf (dcc->incoming_buf, dcc->incoming_offset);
/*
* In LIBIRC_STATE_CONFIRM_SIZE state we don't call any
* callbacks (except there is an error). We just receive
* the data, and compare it with the amount sent.
*/
if ( dcc->state == LIBIRC_STATE_CONFIRM_SIZE )
{
if ( dcc->dccmode != LIBIRC_DCC_SENDFILE )
abort();
if ( dcc->incoming_offset == 4 )
{
unsigned int received_size = ntohl (*((unsigned int*)dcc->incoming_buf));
// Sent size confirmed
if ( dcc->file_confirm_offset == received_size )
{
dcc->state = LIBIRC_STATE_CONNECTED;
dcc->incoming_offset = 0;
}
else
err = LIBIRC_ERR_WRITE;
}
}
else
{
/*
* If it is DCC_CHAT, we send a 0-terminated string
* (which is smaller than offset). Otherwise we send
* a full buffer.
*/
libirc_mutex_unlock (&ircsession->mutex_dcc);
if ( dcc->dccmode != LIBIRC_DCC_CHAT )
{
if ( dcc->dccmode != LIBIRC_DCC_RECVFILE )
abort();
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, dcc->incoming_buf, offset);
/*
* If the session is not terminated in callback,
* put the sent amount into the sent_packet_size_net_byteorder
*/
if ( dcc->state != LIBIRC_STATE_REMOVED )
{
dcc->state = LIBIRC_STATE_CONFIRM_SIZE;
dcc->file_confirm_offset += offset;
*((unsigned int*)dcc->outgoing_buf) = htonl (dcc->file_confirm_offset);
dcc->outgoing_offset = 4;
}
}
else
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, dcc->incoming_buf, strlen(dcc->incoming_buf));
libirc_mutex_lock (&ircsession->mutex_dcc);
if ( dcc->incoming_offset - offset > 0 )
memmove (dcc->incoming_buf, dcc->incoming_buf + offset, dcc->incoming_offset - offset);
dcc->incoming_offset -= offset;
}
}
/*
* If error arises somewhere above, we inform the caller
* of failure, and destroy this session.
*/
if ( err )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
}
/*
* Session might be closed (with sock = -1) after the in_set
* processing, so before out_set processing we should check
* for this case
*/
if ( dcc->state == LIBIRC_STATE_REMOVED )
continue;
/*
* Write bit set - we can send() something, and it won't block.
*/
if ( FD_ISSET (dcc->sock, out_set) )
{
int length, offset, err = 0;
/*
* Because in some cases outgoing_buf could be changed
* asynchronously (by another thread), we should lock
* it.
*/
libirc_mutex_lock (&dcc->mutex_outbuf);
offset = dcc->outgoing_offset;
if ( offset > 0 )
{
length = socket_send (&dcc->sock, dcc->outgoing_buf, offset);
if ( length < 0 )
err = LIBIRC_ERR_WRITE;
else if ( length == 0 )
err = LIBIRC_ERR_CLOSED;
else
{
/*
* If this was DCC_SENDFILE, and we just sent a packet,
* change the state to wait for confirmation (and store
* sent packet size)
*/
if ( dcc->state == LIBIRC_STATE_CONNECTED
&& dcc->dccmode == LIBIRC_DCC_SENDFILE )
{
dcc->file_confirm_offset += offset;
dcc->state = LIBIRC_STATE_CONFIRM_SIZE;
libirc_mutex_unlock (&ircsession->mutex_dcc);
libirc_mutex_unlock (&dcc->mutex_outbuf);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, offset);
libirc_mutex_lock (&ircsession->mutex_dcc);
libirc_mutex_lock (&dcc->mutex_outbuf);
}
if ( dcc->outgoing_offset - length > 0 )
memmove (dcc->outgoing_buf, dcc->outgoing_buf + length, dcc->outgoing_offset - length);
dcc->outgoing_offset -= length;
/*
* If we just sent the confirmation data, change state
* back.
*/
if ( dcc->state == LIBIRC_STATE_CONFIRM_SIZE
&& dcc->dccmode == LIBIRC_DCC_RECVFILE
&& dcc->outgoing_offset == 0 )
{
/*
* If the file is already received, we should inform
* the caller, and close the session.
*/
if ( dcc->received_file_size == dcc->file_confirm_offset )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
libirc_mutex_unlock (&dcc->mutex_outbuf);
(*dcc->cb)(ircsession, dcc->id, 0, dcc->ctx, 0, 0);
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
else
{
/* Continue to receive the file */
dcc->state = LIBIRC_STATE_CONNECTED;
}
}
}
}
libirc_mutex_unlock (&dcc->mutex_outbuf);
/*
* If error arises somewhere above, we inform the caller
* of failure, and destroy this session.
*/
if ( err )
{
libirc_mutex_unlock (&ircsession->mutex_dcc);
(*dcc->cb)(ircsession, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock (&ircsession->mutex_dcc);
libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
}
}
}
libirc_mutex_unlock (&ircsession->mutex_dcc);
}
static int libirc_new_dcc_session (irc_session_t * session, unsigned long ip, unsigned short port, int dccmode, void * ctx, irc_dcc_session_t ** pdcc)
{
irc_dcc_session_t * dcc = malloc (sizeof(irc_dcc_session_t));
if ( !dcc )
return LIBIRC_ERR_NOMEM;
// setup
memset (dcc, 0, sizeof(irc_dcc_session_t));
dcc->dccsend_file_fp = 0;
if ( libirc_mutex_init (&dcc->mutex_outbuf) )
goto cleanup_exit_error;
if ( socket_create (PF_INET, SOCK_STREAM, &dcc->sock) )
goto cleanup_exit_error;
if ( !ip )
{
struct sockaddr_in saddr;
unsigned long arg = 1;
setsockopt (dcc->sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, sizeof(arg));
memset (&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
memcpy (&saddr.sin_addr, &session->local_addr, sizeof(session->local_addr));
saddr.sin_port = htons (0);
if ( bind (dcc->sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0 )
goto cleanup_exit_error;
if ( listen (dcc->sock, 5) < 0 )
goto cleanup_exit_error;
dcc->state = LIBIRC_STATE_LISTENING;
}
else
{
// make socket non-blocking, so connect() call won't block
if ( socket_make_nonblocking (&dcc->sock) )
goto cleanup_exit_error;
memset (&dcc->remote_addr, 0, sizeof(dcc->remote_addr));
dcc->remote_addr.sin_family = AF_INET;
dcc->remote_addr.sin_addr.s_addr = htonl (ip); // what idiot came up with idea to send IP address in host-byteorder?
dcc->remote_addr.sin_port = htons(port);
dcc->state = LIBIRC_STATE_INIT;
}
dcc->dccmode = dccmode;
dcc->ctx = ctx;
time (&dcc->timeout);
// and store it
libirc_mutex_lock (&session->mutex_dcc);
dcc->id = session->dcc_last_id++;
dcc->next = session->dcc_sessions;
session->dcc_sessions = dcc;
libirc_mutex_unlock (&session->mutex_dcc);
*pdcc = dcc;
return 0;
cleanup_exit_error:
if ( dcc->sock >= 0 )
socket_close (&dcc->sock);
free (dcc);
return LIBIRC_ERR_SOCKET;
}
int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid)
{
// This function doesn't actually destroy the session; it just changes
// its state to "removed" and closes the socket. The memory is actually
// freed after the processing loop.
irc_dcc_session_t * dcc = libirc_find_dcc_session (session, dccid, 1);
if ( !dcc )
return 1;
if ( dcc->sock >= 0 )
socket_close (&dcc->sock);
dcc->state = LIBIRC_STATE_REMOVED;
libirc_mutex_unlock (&session->mutex_dcc);
return 0;
}
int irc_dcc_chat (irc_session_t * session, void * ctx, const char * nick, irc_dcc_callback_t callback, irc_dcc_t * dccid)
{
struct sockaddr_in saddr;
socklen_t len = sizeof(saddr);
char cmdbuf[128], notbuf[128];
irc_dcc_session_t * dcc;
int err;
if ( session->state != LIBIRC_STATE_CONNECTED )
{
session->lasterror = LIBIRC_ERR_STATE;
return 1;
}
err = libirc_new_dcc_session (session, 0, 0, LIBIRC_DCC_CHAT, ctx, &dcc);
if ( err )
{
session->lasterror = err;
return 1;
}
if ( getsockname (dcc->sock, (struct sockaddr*) &saddr, &len) < 0 )
{
session->lasterror = LIBIRC_ERR_SOCKET;
libirc_remove_dcc_session (session, dcc, 1);
return 1;
}
sprintf (notbuf, "DCC Chat (%s)", inet_ntoa (saddr.sin_addr));
sprintf (cmdbuf, "DCC CHAT chat %lu %u", (unsigned long) ntohl (saddr.sin_addr.s_addr), ntohs (saddr.sin_port));
if ( irc_cmd_notice (session, nick, notbuf)
|| irc_cmd_ctcp_request (session, nick, cmdbuf) )
{
libirc_remove_dcc_session (session, dcc, 1);
return 1;
}
*dccid = dcc->id;
dcc->cb = callback;
dcc->dccmode = LIBIRC_DCC_CHAT;
return 0;
}
int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const char * text)
{
irc_dcc_session_t * dcc = libirc_find_dcc_session (session, dccid, 1);
if ( !dcc )
return 1;
if ( dcc->dccmode != LIBIRC_DCC_CHAT )
{
session->lasterror = LIBIRC_ERR_INVAL;
libirc_mutex_unlock (&session->mutex_dcc);
return 1;
}
if ( (strlen(text) + 2) >= (sizeof(dcc->outgoing_buf) - dcc->outgoing_offset) )
{
session->lasterror = LIBIRC_ERR_NOMEM;
libirc_mutex_unlock (&session->mutex_dcc);
return 1;
}
libirc_mutex_lock (&dcc->mutex_outbuf);
strcpy (dcc->outgoing_buf + dcc->outgoing_offset, text);
dcc->outgoing_offset += strlen (text);
dcc->outgoing_buf[dcc->outgoing_offset++] = 0x0D;
dcc->outgoing_buf[dcc->outgoing_offset++] = 0x0A;
libirc_mutex_unlock (&dcc->mutex_outbuf);
libirc_mutex_unlock (&session->mutex_dcc);
return 0;
}
static void libirc_dcc_request (irc_session_t * session, const char * nick, const char * req)
{
char filenamebuf[256];
unsigned long ip, size;
unsigned short port;
if ( sscanf (req, "DCC CHAT chat %lu %hu", &ip, &port) == 2 )
{
if ( session->callbacks.event_dcc_chat_req )
{
irc_dcc_session_t * dcc;
int err = libirc_new_dcc_session (session, ip, port, LIBIRC_DCC_CHAT, 0, &dcc);
if ( err )
{
session->lasterror = err;
return;
}
(*session->callbacks.event_dcc_chat_req) (session,
nick,
inet_ntoa (dcc->remote_addr.sin_addr),
dcc->id);
}
return;
}
else if ( sscanf (req, "DCC SEND %s %lu %hu %lu", filenamebuf, &ip, &port, &size) == 4 )
{
if ( session->callbacks.event_dcc_send_req )
{
irc_dcc_session_t * dcc;
int err = libirc_new_dcc_session (session, ip, port, LIBIRC_DCC_RECVFILE, 0, &dcc);
if ( err )
{
session->lasterror = err;
return;
}
(*session->callbacks.event_dcc_send_req) (session,
nick,
inet_ntoa (dcc->remote_addr.sin_addr),
filenamebuf,
size,
dcc->id);
dcc->received_file_size = size;
}
return;
}
#if defined (ENABLE_DEBUG)
fprintf (stderr, "BUG: Unhandled DCC message: %s\n", req);
abort();
#endif
}
int irc_dcc_accept (irc_session_t * session, irc_dcc_t dccid, void * ctx, irc_dcc_callback_t callback)
{
irc_dcc_session_t * dcc = libirc_find_dcc_session (session, dccid, 1);
if ( !dcc )
return 1;
if ( dcc->state != LIBIRC_STATE_INIT )
{
session->lasterror = LIBIRC_ERR_STATE;
libirc_mutex_unlock (&session->mutex_dcc);
return 1;
}
dcc->cb = callback;
dcc->ctx = ctx;
// Initiate the connect
if ( socket_connect (&dcc->sock, (struct sockaddr *) &dcc->remote_addr, sizeof(dcc->remote_addr)) )
{
libirc_dcc_destroy_nolock (session, dccid);
libirc_mutex_unlock (&session->mutex_dcc);
session->lasterror = LIBIRC_ERR_CONNECT;
return 1;
}
dcc->state = LIBIRC_STATE_CONNECTING;
libirc_mutex_unlock (&session->mutex_dcc);
return 0;
}
int irc_dcc_decline (irc_session_t * session, irc_dcc_t dccid)
{
irc_dcc_session_t * dcc = libirc_find_dcc_session (session, dccid, 1);
if ( !dcc )
return 1;
if ( dcc->state != LIBIRC_STATE_INIT )
{
session->lasterror = LIBIRC_ERR_STATE;
libirc_mutex_unlock (&session->mutex_dcc);
return 1;
}
libirc_dcc_destroy_nolock (session, dccid);
libirc_mutex_unlock (&session->mutex_dcc);
return 0;
}
int irc_dcc_sendfile (irc_session_t * session, void * ctx, const char * nick, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * dccid)
{
struct sockaddr_in saddr;
socklen_t len = sizeof(saddr);
char cmdbuf[128], notbuf[128];
irc_dcc_session_t * dcc;
const char * p;
int err;
long filesize;
if ( !session || !dccid || !filename || !callback )
{
session->lasterror = LIBIRC_ERR_INVAL;
return 1;
}
if ( session->state != LIBIRC_STATE_CONNECTED )
{
session->lasterror = LIBIRC_ERR_STATE;
return 1;
}
if ( (err = libirc_new_dcc_session (session, 0, 0, LIBIRC_DCC_SENDFILE, ctx, &dcc)) != 0 )
{
session->lasterror = err;
return 1;
}
if ( (dcc->dccsend_file_fp = fopen (filename, "rb")) == 0 )
{
libirc_remove_dcc_session (session, dcc, 1);
session->lasterror = LIBIRC_ERR_OPENFILE;
return 1;
}
/* Get file length */
if ( fseek (dcc->dccsend_file_fp, 0, SEEK_END)
|| (filesize = ftell (dcc->dccsend_file_fp)) == -1
|| fseek (dcc->dccsend_file_fp, 0, SEEK_SET) )
{
libirc_remove_dcc_session (session, dcc, 1);
session->lasterror = LIBIRC_ERR_NODCCSEND;
return 1;
}
if ( getsockname (dcc->sock, (struct sockaddr*) &saddr, &len) < 0 )
{
libirc_remove_dcc_session (session, dcc, 1);
session->lasterror = LIBIRC_ERR_SOCKET;
return 1;
}
// Remove path from the filename
if ( (p = strrchr (filename, '\\')) == 0
&& (p = strrchr (filename, '/')) == 0 )
p = filename;
else
p++; // skip directory slash
sprintf (notbuf, "DCC Send %s (%s)", p, inet_ntoa (saddr.sin_addr));
sprintf (cmdbuf, "DCC SEND %s %lu %u %ld", p, (unsigned long) ntohl (saddr.sin_addr.s_addr), ntohs (saddr.sin_port), filesize);
if ( irc_cmd_notice (session, nick, notbuf)
|| irc_cmd_ctcp_request (session, nick, cmdbuf) )
{
libirc_remove_dcc_session (session, dcc, 1);
return 1;
}
*dccid = dcc->id;
dcc->cb = callback;
return 0;
}
|
liimur/IRCClientiOS
|
Classes/IRCClientSession.h
|
<reponame>liimur/IRCClientiOS
/*! \mainpage IRCClient - a Cocoa IRC Framework to create IRC clients
*
* \section intro_sec Introduction
*
* IRCClient is a Cocoa Framework that uses the excellent libircclient library
* written by <NAME>.
*
* \section usage Basic Usage
*
* To use this framework, you will need to write an IRCClientSessionDelegate to
* handle all of the events generated by the server, and an IRCClientChannelDelegate
* to handle all of the events generated by channels on that server.
*
* You then create an IRCClientSession object in your code, assign the required
* properties, and call connect: to connect to the server and run: to create
* the new thread and start receiving events. For example:
*
* \code
* IRCClientSession *session = [[IRCClientSession alloc] init];
* MyIRCClientSessionDelegate *controller = [[MyIRCClientSessionDelegate alloc] init];
*
* [session setDelegate:controller];
* [controller setSession:session];
*
* [session setServer:@"irc.dal.net"];
* [session setPort:@"6667"];
* [session setNickname:@"test"];
* [session setUsername:@"test"];
* [session setRealname:@"test"];
* [session connect];
*
* [session run]; //starts the thread
* \endcode
*
* \section author Author, copyright, support.
*
* If you have any questions, bug reports, suggestions regarding libircclient
* or the IRCClient framework, please visit http://libircclient.sourceforge.net
*
* <PRE>
* libircclient Copyright (C) 2004-2009 <NAME> <EMAIL>
* IRCClient Copyright (C) 2009 <NAME> <EMAIL>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
* </PRE>
*/
/**
* @file IRCClientSession.h
* @author <NAME>
* @version 1.0
* @date 01.2009
* @brief Represents a connected IRC Session.
*/
#import "IRCClientSessionDelegate.h"
#include "libircclient.h"
/** @class IRCClientSession
* @brief Represents a connected IRC Session.
*
* IRCClientSession represents a single connection to an IRC server. On initialising
* the object, and setting the delegate, server, port, password, nickname, username and realname
* properties, you call the connect: and run: methods to connect to the IRC server
* and start a new thread.
*
* This thread then sends messages back to the main runloop to the IRC server delegate,
* or to the IRCClientChannel delegate as required.
*/
@class IRCClientChannel;
@interface IRCClientSession : NSObject {
id delegate;
irc_callbacks_t callbacks;
irc_session_t *session;
NSThread *thread;
NSString *version;
NSString *server;
NSString *port;
NSString *password;
NSString *nickname;
NSString *username;
NSString *realname;
NSMutableDictionary *channels;
NSMutableDictionary *nicks;
NSStringEncoding encoding;
}
/** delegate to send events to. */
@property (assign) id delegate;
/** The underlying libircclient handle */
@property (assign) irc_session_t *session;
/** The version string for the client to send back on CTCP VERSION requests */
@property (copy) NSString *version;
/** IRC server to connect to */
@property (copy) NSString *server;
/** IRC port to connect to */
@property (copy) NSString *port;
/** Server password to provide on connect (may be left empty or nil) */
@property (copy) NSString *password;
/** Nickname of the connected client. Note that setting this after connection will
not result in the client renaming on IRC. You need to send a nick: message instead.
*/
@property (copy) NSString *nickname;
/** Username of the connected client. Also known as the ident.
Setting this after connection does nothing.
*/
@property (copy) NSString *username;
/** Realname of the connected client.
Setting this after connection does nothing. */
@property (copy) NSString *realname;
/** An NSMutableDictionary of channels that the client is currently connected to.
You should not modify this. */
@property (assign,readonly) NSMutableDictionary *channels;
/** The default text encoding for messages on this server.
This affects messages received via PRIVMSG and NOTICE, and TOPIC in a channel.
You may change this at any time.
*/
@property (assign) NSStringEncoding encoding;
/** Connect to the IRC server.
Note that this performs the initial DNS lookup and the TCP connection, so if
there are any problems you will be notified via the return code of the message.
Look at the libircclient documentation for the different return codes. */
- (int)connect;
/** Disconnect from the IRC server.
This always works, as it simply shuts down the socket. If you want to disconnect
in a friendly way, you should use the quit: message. */
- (void)disconnect;
/** returns YES if the server is currently connected successfully, and NO if
it is not. */
- (bool)isConnected;
/** Starts a new thread and starts the libircclient runloop, processing events and
firing messages back to the main runloop as required. Calling this again will
do nothing other than raise a warning in your logs. */
- (void)run;
/** Sends a raw message to the IRC server. Please consult rfc1459 for the format
of IRC commands. */
- (int)sendRawWithFormat:(NSString *)format, ...;
/** quits the IRC server with the given reason. On success, an onQuit event will be
sent to the IRCClientSessionDelegate with the nickname of the IRC client.
The format is a standard NSString format string, followed by optional arguments.
*/
- (int)quit:(NSString *)reason;
/** Joins a channel with a given name and key
@param channel the channel to join
@param key they key for the channel (may be nil)
*/
- (int)join:(NSString *)channel key:(NSString *)key;
/** lists channels on the IRC server.
@param channel a channel name or string to pass to the LIST command. Implementation specific.
*/
- (int)list:(NSString *)channel;
/** sets the user mode for the IRC client
@param mode string to set
*/
- (int)userMode:(NSString *)mode;
/** sets the IRC client nickname. On success, an onNick event will be sent to the delegate
@param newnick new nickname to set.
*/
- (int)nick:(NSString *)newnick;
/** sends a WHOIS request to the IRC server
@param nick nickname of the irc client to whois.
*/
- (int)whois:(NSString *)nick;
/** send a PRIVMSG to another IRC client
@param message message to send
@param target the other IRC client to send the message to.
*/
- (int)message:(NSString *)message to:(NSString *)target;
/** send a CTCP ACTION to another IRC client
@param action the action message to send
@param target the nickname of the irc client to send the message to.
*/
- (int)action:(NSString *)action to:(NSString *)target;
/** send a NOTICE to another IRC client
@param notice the message text to send
@param target the nickname of the irc client to send the notice to.
*/
- (int)notice:(NSString *)notice to:(NSString *)target;
/** send a CTCP request to another IRC client
@param request the CTCP request string to send
@param target the nickname of the IRC client to send the request to.
*/
- (int)ctcpRequest:(NSString *)request target:(NSString *)target;
/** send a CTCP reply to another IRC client
@param reply the CTCP reply string to send
@param target the nickname of the IRC client to send the reply to.
*/
- (int)ctcpReply:(NSString *)reply target:(NSString *)target;
@end
|
liimur/IRCClientiOS
|
Classes/IRCClientSessionDelegate.h
|
<gh_stars>1-10
/*
* Copyright (C) 2009 <NAME> <EMAIL>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
//#import <Cocoa/Cocoa.h>
#include "libircclient.h"
/**
* @file IRCClientChannelDelegate.h
* @author <NAME>
* @version 1.0
* @date 01.2009
* @brief Receives delegate messages from an IRCClientSession.
* @protocol IRCClientSessionDelegate
*/
@class IRCClientChannel;
/** @brief Receives delegate messages from an IRCClientSession.
*
* Each IRCClientSession object needs a single delegate. Methods are called
* for each event that occurs on an IRC server that the client is connected to.
*
* Note that for any given parameter, it may be optional, in which case a nil
* object may be supplied instead of the given parameter.
*/
@interface NSObject (IRCClientSessionDelegate)
/** The client has successfully connected to the IRC server. */
- (void)onConnect;
/** An IRC client on a channel that this client is connected to has changed nickname,
* or this IRC client has changed nicknames.
*
* @param nick the new nickname
* @param oldNick the old nickname
*/
- (void)onNick:(NSString *)nick oldNick:(NSString *)oldNick;
/** An IRC client on a channel that this client is connected to has quit IRC.
*
* @param nick the nickname of the client that quit.
* @param reason (optional) the quit message, if any.
*/
- (void)onQuit:(NSString *)nick reason:(NSString *)reason;
/** The IRC client has joined (connected) successfully to a new channel. This
* event creates an IRCClientChannel object, which you are expected to asign a
* delegate to, to handle events from the channel.
*
* For example, on receipt of this message, a graphical IRC client would most
* likely open a new window, create an IRCClientChannelDelegate for the window,
* set the new IRCClientChannel's delegate to the new delegate, and then hook
* it up so that new events sent to the IRCClientChannelDelegate are sent to
* the window.
*
* @param channel the IRCClientChannel object for the newly joined channel.
*/
- (void)onJoinChannel:(IRCClientChannel *)channel;
/** The client has changed it's user mode.
*
* @param mode the new mode.
*/
- (void)onMode:(NSString *)mode;
/** The client has received a private PRIVMSG from another IRC client.
*
* @param message the text of the message
* @param nick the other IRC Client that sent the message.
*/
- (void)onPrivmsg:(NSData *)message nick:(NSString *)nick;
/** The client has received a private NOTICE from another client.
*
* @param notice the text of the message
* @param nick the nickname of the other IRC client that sent the message.
*/
- (void)onNotice:(NSData *)notice nick:(NSString *)nick;
/** The IRC client has been invited to a channel.
*
* @param channel the channel for the invitation.
* @param nick the nickname of the user that sent the invitation.
*/
- (void)onInvite:(NSString *)channel nick:(NSString *)nick;
/** A private CTCP request was sent to the IRC client.
*
* @param request the CTCP request string (after the type)
* @param type the CTCP request type
* @param nick the nickname of the user that sent the request.
*/
- (void)onCtcpRequest:(NSString *)request type:(NSString *)type nick:(NSString *)nick;
/** A private CTCP reply was sent to the IRC client.
*
* @param reply an NSData containing the raw C string of the reply.
* @param nick the nickname of the user that sent the reply.
*/
- (void)onCtcpReply:(NSData *)reply nick:(NSString *)nick;
/** A private CTCP ACTION was sent to the IRC client.
*
* CTCP ACTION is not limited to channels; it may also be sent directly to other users.
*
* @param action the action message text.
* @param nick the nickname of the client that sent the action.
*/
- (void)onAction:(NSData *)action nick:(NSString *)nick;
/** An unhandled event was received from the IRC server.
*
* @param event the unknown event name
* @param origin the sender of the event
* @param params an NSArray of NSData objects that are the raw C strings of the event.
*/
- (void)onUnknownEvent:(NSString *)event origin:(NSString *)origin params:(NSArray *)params;
/** An unhandled numeric was received from the IRC server
*
* @param event the unknown event number
* @param origin the sender of the event
* @param params an NSArray of NSData objects that are the raw C strings of the event.
*/
- (void)onNumericEvent:(NSUInteger)event origin:(NSString *)origin params:(NSArray *)params;
@end
|
liimur/IRCClientiOS
|
External/libircclient/src/portable.c
|
/*
* Copyright (C) 2004-2009 <NAME> <EMAIL>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*/
#if !defined (WIN32)
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#if defined (ENABLE_THREADS)
#include <pthread.h>
typedef pthread_mutex_t port_mutex_t;
#if !defined (PTHREAD_MUTEX_RECURSIVE) && defined (PTHREAD_MUTEX_RECURSIVE_NP)
#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
#endif
#endif
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <time.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#if defined (ENABLE_THREADS)
typedef CRITICAL_SECTION port_mutex_t;
#endif
#define inline
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strncasecmp _strnicmp
#endif
#if defined (ENABLE_THREADS)
static inline int libirc_mutex_init (port_mutex_t * mutex)
{
#if defined (WIN32)
InitializeCriticalSection (mutex);
return 0;
#elif defined (PTHREAD_MUTEX_RECURSIVE)
pthread_mutexattr_t attr;
return (pthread_mutexattr_init (&attr)
|| pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE)
|| pthread_mutex_init (mutex, &attr));
#else /* !defined (PTHREAD_MUTEX_RECURSIVE) */
return pthread_mutex_init (mutex, 0);
#endif /* defined (WIN32) */
}
static inline void libirc_mutex_destroy (port_mutex_t * mutex)
{
#if defined (WIN32)
DeleteCriticalSection (mutex);
#else
pthread_mutex_destroy (mutex);
#endif
}
static inline void libirc_mutex_lock (port_mutex_t * mutex)
{
#if defined (WIN32)
EnterCriticalSection (mutex);
#else
pthread_mutex_lock (mutex);
#endif
}
static inline void libirc_mutex_unlock (port_mutex_t * mutex)
{
#if defined (WIN32)
LeaveCriticalSection (mutex);
#else
pthread_mutex_unlock (mutex);
#endif
}
#else
typedef void * port_mutex_t;
static inline int libirc_mutex_init (port_mutex_t * mutex) { return 0; }
static inline void libirc_mutex_destroy (port_mutex_t * mutex) {}
static inline void libirc_mutex_lock (port_mutex_t * mutex) {}
static inline void libirc_mutex_unlock (port_mutex_t * mutex) {}
#endif
/*
* Stub for WIN32 dll to initialize winsock API
*/
#if defined (_USRDLL)
BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
{
WORD wVersionRequested = MAKEWORD (1, 1);
WSADATA wsaData;
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
if ( WSAStartup (wVersionRequested, &wsaData) != 0 )
return FALSE;
DisableThreadLibraryCalls (hinstDll);
break;
case DLL_PROCESS_DETACH:
WSACleanup();
break;
}
return TRUE;
}
#endif
|
AmbushConsulting/AHKActionSheet
|
Classes/AHKActionSheet.h
|
<filename>Classes/AHKActionSheet.h
//
// AHKActionSheet.h
// AHKActionSheetExample
//
// Created by Arkadiusz on 08-04-14.
// Copyright (c) 2014 <NAME>. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, AHKActionSheetButtonType) {
AHKActionSheetButtonTypeDefault = 0,
AHKActionSheetButtonTypeDestructive,
AHKActionSheetButtonTypeUnselectable
};
@class AHKActionSheet;
@class AHKActionSheetItem;
typedef void(^AHKActionSheetHandler)(AHKActionSheet *actionSheet);
@interface AHKActionSheetItem : NSObject
@property (copy, nonatomic) NSString *title;
@property (strong, nonatomic) UIImage *image;
@property (nonatomic) BOOL selected;
@property (nonatomic) BOOL alreadySelected;
@property (nonatomic) AHKActionSheetButtonType type;
@property (strong, nonatomic) AHKActionSheetHandler handler;
@property(nonatomic, copy) void (^postDoneHandler)(AHKActionSheet *);
@property(nonatomic, copy) void (^clickHandler)(AHKActionSheetItem *item, UITableViewCell *cell);
@property(nonatomic) enum UITableViewCellSelectionStyle selectionStyle;
@end
@interface AHKActionSheet : UIView <UIAppearanceContainer>
// Appearance
/**
* See UIImage+AHKAdditions.h/.m to learn how these three properties are used.
*/
@property (nonatomic) CGFloat blurRadius UI_APPEARANCE_SELECTOR;
@property (strong, nonatomic) UIColor *blurTintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic) CGFloat blurSaturationDeltaFactor UI_APPEARANCE_SELECTOR;
/// Height of the button (internally it's a UITableViewCell).
@property (nonatomic) CGFloat buttonHeight UI_APPEARANCE_SELECTOR;
/// Height of the cancel button (internally it's a UIButton).
@property (nonatomic) CGFloat cancelButtonHeight UI_APPEARANCE_SELECTOR;
/**
* If set, a small shadow (a gradient layer) will be drawn above the cancel button to separate it visually from the other buttons.
* It's best to use a color similar (but maybe with a lower alpha value) to blurTintColor.
* See "Advanced" example in the example project to see it used.
*/
@property (strong, nonatomic) UIColor *cancelButtonShadowColor UI_APPEARANCE_SELECTOR;
/// Boxed (@YES, @NO) boolean value (enabled by default)
@property (strong, nonatomic) NSNumber *automaticallyTintButtonImages UI_APPEARANCE_SELECTOR;
/// Boxed boolean value. Useful when adding buttons without images (in that case text looks better centered). Disabled by default.
@property (strong, nonatomic) NSNumber *buttonTextCenteringEnabled UI_APPEARANCE_SELECTOR;
/// Color of the separator between buttons.
@property (strong, nonatomic) UIColor *separatorColor UI_APPEARANCE_SELECTOR;
/// Background color of the button when it's tapped (internally it's a UITableViewCell)
@property (strong, nonatomic) UIColor *selectedBackgroundColor UI_APPEARANCE_SELECTOR;
/// Text attributes of the title (passed in the initializer or set via `title` property)
@property (copy, nonatomic) NSDictionary *titleTextAttributes UI_APPEARANCE_SELECTOR;
@property (copy, nonatomic) NSDictionary *buttonTextAttributes UI_APPEARANCE_SELECTOR;
@property (copy, nonatomic) NSDictionary *destructiveButtonTextAttributes UI_APPEARANCE_SELECTOR;
@property (copy, nonatomic) NSDictionary *cancelButtonTextAttributes UI_APPEARANCE_SELECTOR;
/// Called on every type of dismissal (tapping on "Cancel" or swipe down or flick down).
@property (strong, nonatomic) AHKActionSheetHandler cancelHandler;
@property (copy, nonatomic) NSString *cancelButtonTitle;
/// Action sheet title shown above the buttons.
@property (copy, nonatomic) NSString *title;
/// View shown above the buttons (only if the title isn't set).
@property (strong, nonatomic) UIView *headerView;
/// Window visible before the actionSheet was presented.
@property (weak, nonatomic, readonly) UIWindow *previousKeyWindow;
@property (nonatomic) BOOL hidesAfterSelection;
//Customized Values
@property(nonatomic, strong) NSNumber *cancelAsSeparateButton;
@property(nonatomic, strong) UIColor *cellBackgroundColor;
@property(nonatomic, strong) UIColor *closeButtonTintColor;
@property(nonatomic, strong) UIColor *headerViewBackgroundColor;
@property(nonatomic) NSTextAlignment labelTextAlignment;
@property(nonatomic) BOOL hideStatusBar;
// Designated initializer.
- (instancetype)initWithTitle:(NSString *)title;
- (instancetype)initWithTitleAndDontDismiss:(NSString *)title;
- (void)addButtonWithTitle:(NSString *)title type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler;
- (void)addButtonWithTitle:(NSString *)title image:(UIImage *)image type:(AHKActionSheetButtonType)type handler:(AHKActionSheetHandler)handler;
- (void)showWithFanciness:(UIView *)theView;
- (void)show;
- (void)dismissAnimated:(BOOL)animated;
- (void)addButtonWithTitle:(NSString *)topic image:(UIImage *)image type:(enum AHKActionSheetButtonType)type postDoneHandler:(void (^) (AHKActionSheet *))handler clickHandler:(void (^)(AHKActionSheetItem *, UITableViewCell *))clickHandler setSelected:(BOOL)selected;
@property(nonatomic, copy) void (^postDoneHandler)(AHKActionSheet *item);
@end
|
AmbushConsulting/AHKActionSheet
|
Classes/UIView+Snapshots.h
|
//
// UIView+Snapshots.h
// AHKActionSheetExample
//
// Created by Arkadiusz on 08-04-14.
// Copyright (c) 2014 <NAME>. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (Snapshots)
- (UIImage *)AHKsnapshotImage;
@end
|
AmbushConsulting/AHKActionSheet
|
Classes/UIWindow+AHKAdditions.h
|
<reponame>AmbushConsulting/AHKActionSheet<filename>Classes/UIWindow+AHKAdditions.h
//
// UIWindow+AHKAdditions.h
// AHKActionSheetExample
//
// Created by Arkadiusz on 14-04-14.
// Copyright (c) 2014 <NAME>. All rights reserved.
//
// Original source: https://github.com/Sumi-Interactive/SIAlertView/blob/master/SIAlertView/UIWindow%2BSIUtils.h
#import <UIKit/UIKit.h>
@interface UIWindow (AHKAdditions)
- (UIViewController *)AHKviewControllerForStatusBarStyle;
- (UIViewController *)AHKviewControllerForStatusBarHidden;
@end
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars/battle.h
|
<filename>Starwars/battle.h
#ifndef JNP4_BATTLE_H
#define JNP4_BATTLE_H
#include <iostream>
#include <type_traits>
#include <cassert>
#include <tuple>
#include <array>
#include <cmath>
#include <algorithm>
#include "rebelfleet.h"
#include "imperialfleet.h"
template<typename T, T i, T t1>
static constexpr T root(){
if constexpr(i*i > t1) {
return i;
}
else {
return root<T, i+1, t1>();
}
}
template<typename T, T t0, T t1, typename...S>
class SpaceBattle{
private:
T timeElapsed;
int rebelStrength;
int imperialStrength;
std::tuple<S...> battlingShips;
std::array<T, root<T, 0, t1>()> attackWindows;
public:
SpaceBattle(S... ship) : battlingShips(ship...) {
rebelStrength = 0;
imperialStrength = 0;
attackWindows = calcWindows();
countForces(battlingShips);
timeElapsed = t0;
assert(t0 < t1 && t0 >= 0);
}
template<size_t n = 0, typename ...xs>
constexpr void countForces(std::tuple<xs...> &t) {
if constexpr (n < sizeof...(xs)) {
if (std::tuple_element_t<n, std::tuple<xs...>>::isImperial()){
if (std::get<n>(t).getShield() != 0) imperialStrength++;
}
else{
if (std::get<n>(t).getShield() != 0) rebelStrength++;
}
countForces<n + 1, xs...>(t);
}
}
constexpr static ::std::array<T, root<T, 0, t1>()>calcWindows() {
static_assert(std::is_integral<T>::value && t0 <= t1 && t0 >= 0);
std::array<T, root<T, 0, t1>()> gaps{0};
T current = 0;
while(current < root<T, 0, t1>()){
gaps[current] = pow(current, 2);
current++;
}
return gaps;
}
template<size_t n = 0, typename ...xs, typename I>
constexpr void getRebelShips(std::tuple<xs...> &t, ImperialStarship<I> &imperial) {
if constexpr (n < sizeof...(xs)) {
if constexpr (!std::tuple_element_t<n, std::tuple<xs...>>::isImperial()){
auto &ship = std::get<n>(t);
if(ship.getShield() != 0 && imperial.getShield() != 0){
attack(imperial, ship);
if(ship.getShield() == 0) rebelStrength--;
if(imperial.getShield() == 0) imperialStrength--;
}
}
getRebelShips<n + 1, xs...>(t, imperial);
}
}
template<size_t n = 0, typename ...xs>
constexpr void getImperialShips(std::tuple<xs...> &t) {
if constexpr (n < sizeof...(xs)) {
if constexpr (std::tuple_element_t<n, std::tuple<xs...>>::isImperial()){
auto &ship = std::get<n>(t);
if(ship.getShield() != 0) {
getRebelShips<0, xs...>(t, ship);
}
}
getImperialShips<n + 1, xs...>(t);
}
}
int countRebelFleet() {
return rebelStrength;
}
int countImperialFleet() {
return imperialStrength;
}
void fight(){
getImperialShips(battlingShips);
}
void tick(T timeStep) {
if(imperialStrength == 0 && rebelStrength == 0) std::cout << "DRAW\n";
if(imperialStrength == 0 && rebelStrength != 0) std::cout << "REBELLION WON\n";
if(imperialStrength != 0 && rebelStrength == 0) std::cout << "IMPERIUM WON\n";
bool intoBattle = std::find(std::begin(attackWindows), std::end(attackWindows), timeElapsed) != std::end(attackWindows);
if(intoBattle) fight();
timeElapsed = (timeElapsed + timeStep) % (t1 + 1);
}
};
#endif
|
j-kk/Languages-and-Tools-for-Programming
|
Wallet/wallet_svn.h
|
#ifndef WALLET_H
#define WALLET_H
#include <iostream>
#include <vector>
#include <string>
#include <chrono>
#include <utility>
using namespace std::rel_ops;
using std::vector;
using std::ostream;
using std::string;
using namespace std::chrono;
using ll = long long;
using ull = unsigned long long;
// OPERATION
class Operation {
private:
ll balance_after;
time_point<system_clock> timestamp;
public:
Operation(ll balance);
ll getUnits() const;
bool operator==(const Operation &o2) const;
bool operator<(const Operation &o2) const;
friend ostream& operator<<(ostream& os, const Operation &o0);
};
// WALLET
class Wallet {
private:
template<typename T>
Wallet(T t);
const static ll max_BajtekCoin_amount;
static ll BajtekCoin_amount;
ll balance;
vector<Operation> history;
bool can_create_B(ll balance);
public:
Wallet();
Wallet(int starting_balance_B);
explicit Wallet(const char * starting_balance_text);
explicit Wallet(const string & starting_balance_text);
Wallet(Wallet &&w2);
Wallet(Wallet &&w1, Wallet &&w2);
static Wallet fromBinary(const char * binaryStartingBalance);
static Wallet fromBinary(const string & binaryStartingBalance);
Wallet(Wallet &w1) = delete;
~Wallet();
Wallet & operator=(Wallet &w2) = delete;
Wallet & operator=(Wallet &&w2);
Wallet & operator+=(Wallet &w2);
Wallet & operator+=(Wallet &&w2);
friend Wallet && operator+(Wallet &&w1, Wallet &&w2);
friend Wallet && operator+(Wallet &&w1, Wallet &w2);
Wallet & operator*=(int x);
friend Wallet && operator*(int x, Wallet &&w);
friend Wallet && operator*(Wallet &&w1, int x);
friend Wallet && operator*(int x, Wallet &w);
friend Wallet && operator*(Wallet &w1, int x);
Wallet & operator-=(Wallet &w2);
Wallet & operator-=(Wallet &&w2);
friend Wallet && operator-(Wallet &&w1, Wallet &&w2);
friend Wallet && operator-(Wallet &&w1, Wallet &w2);
friend bool operator== (const Wallet &&w1, const Wallet &&w2);
friend bool operator== (const Wallet &&w1, const Wallet &w2);
friend bool operator== (const Wallet &&w, ll x);
friend bool operator== (const Wallet &w1, const Wallet &&w2);
friend bool operator== (const Wallet &w1, const Wallet &w2);
friend bool operator== (const Wallet &w, ll x);
friend bool operator== (ll x, const Wallet &w);
friend bool operator== (ll x, const Wallet &&w);
friend bool operator< (const Wallet &&w1, const Wallet &&w2);
friend bool operator< (const Wallet &&w1, const Wallet &w2);
friend bool operator< (const Wallet &&w, ll x);
friend bool operator< (const Wallet &w1, const Wallet &&w2);
friend bool operator< (const Wallet &w1, const Wallet &w2);
friend bool operator< (const Wallet &w, ll x);
friend bool operator< (ll x, const Wallet &w);
friend bool operator< (ll x, const Wallet &&w);
friend ostream & operator<<(ostream& os, const Wallet &w0);
ll getUnits() const;
ull opSize() const;
Operation & operator[] (size_t i) const;
};
const Wallet & Empty();
#endif
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars 2/battle.h
|
#ifndef MJ394327_JK394387_BATTLE_H
#define MJ394327_JK394387_BATTLE_H
#include <cstdio>
#include <vector>
#include "imperialfleet.h"
#include "rebelfleet.h"
#include <iostream>
using Time = long long;
class SpaceTime {
public:
SpaceTime() = default;
bool isAttackTime(Time currentTime) {
return ((currentTime % 2 == 0 || currentTime % 3 == 0) && currentTime % 5 != 0);
}
};
class SpaceBattle {
private:
Time currentTime;
Time maxTime;
SpaceTime clock;
std::vector<std::shared_ptr<ImperialUnit>> imperialStarships;
std::vector<std::shared_ptr<RebelStarship>> rebelStarships;
public:
class Builder;
SpaceBattle(Time startTime, Time maxTime, std::vector<std::shared_ptr<ImperialUnit>> imperialStarhips,
std::vector<std::shared_ptr<RebelStarship>> rebelStarships): currentTime(startTime),
maxTime(maxTime), imperialStarships(std::move(imperialStarhips)), rebelStarships(std::move(rebelStarships)) {
assert(startTime >= 0 && maxTime >= 0 && startTime <= maxTime);
}
size_t countImperialFleet() {
size_t res = 0;
for (auto &ship: imperialStarships) {
res += ship->count();
}
return res;
}
size_t countRebelFleet() {
size_t res = 0;
for (auto &ship: rebelStarships) {
if (!ship->isDead()) {
res++;
}
}
return res;
}
bool checkForWinner() {
if (countImperialFleet() == 0) {
if (countRebelFleet() == 0) {
std::cout << "DRAW\n";
return true;
}
else {
std::cout << "REBELLION WON\n";
return true;
}
}
else {
if (countRebelFleet() == 0) {
std::cout << "IMPERIUM WON\n";
return true;
}
}
return false;
}
void tick(Time timeStep) {
if (!checkForWinner() && clock.isAttackTime(currentTime)) { // Faktyczna bitwa.
for (auto &imperialStarship: imperialStarships) {
for (auto &rebelStarship: rebelStarships) {
if (!imperialStarship->isDead() && !rebelStarship->isDead()) {
rebelStarship->beAttacked(*imperialStarship);
}
}
}
}
currentTime = (currentTime + timeStep) % (maxTime + 1);
}
};
class SpaceBattle::Builder {
private:
Time startingTime;
Time maximumTime;
std::vector<std::shared_ptr<ImperialUnit>> imperialStarships;
std::vector<std::shared_ptr<RebelStarship>> rebelStarships;
public:
Builder &ship(std::shared_ptr<RebelStarship> ship) {
rebelStarships.push_back(ship);
return *this;
}
Builder &ship(std::shared_ptr<ImperialUnit> ship) {
imperialStarships.push_back(ship);
return *this;
}
Builder &ship(std::shared_ptr<Squadron> ship) {
imperialStarships.push_back(ship);
return *this;
}
Builder &startTime(Time time) {
startingTime = time;
return *this;
}
Builder &maxTime(Time time) {
maximumTime = time;
return *this;
}
SpaceBattle build() {
return SpaceBattle(startingTime, maximumTime, imperialStarships, rebelStarships);
}
};
#endif //MJ394327_JK394387_BATTLE_H
|
j-kk/Languages-and-Tools-for-Programming
|
Citation Graph/citation_graph.h
|
<reponame>j-kk/Languages-and-Tools-for-Programming<gh_stars>0
#ifndef CITATION_GRAPH_H
#define CITATION_GRAPH_H
#include <vector>
#include <map>
#include <memory>
#include <set>
struct PublicationAlreadyCreated : public std::exception {
const char *what() const noexcept override {
return "PublicationAlreadyCreated";
}
};
struct TriedToRemoveRoot : public std::exception {
const char *what() const noexcept override {
return "TriedToRemoveRoot";
}
};
struct PublicationNotFound : public std::exception {
const char *what() const noexcept override {
return "PublicationNotFound";
}
};
template<class Publication>
class CitationGraph {
private:
class Node;
public:
using id_type = typename Publication::id_type;
using map_type = std::map<id_type, std::shared_ptr<Node>>;
using map_type_ptr = std::shared_ptr<map_type>;
private:
class Node {
public:
std::set<std::shared_ptr<Node>, std::owner_less<std::shared_ptr<Node>>> children;
std::set<std::weak_ptr<Node>, std::owner_less<std::weak_ptr<Node>>> parents;
map_type_ptr graph_ptr;
Publication publication;
typename map_type::iterator map_iterator;
Node(id_type const &stem_id, map_type_ptr graph)
: publication(stem_id) {
graph_ptr = graph;
map_iterator = graph_ptr->end();
}
void disconnect(std::shared_ptr<Node> node) {
for (auto child : children) {
child->parents.erase(node);
}
node->children.clear();
for (auto &parent : node->parents) {
parent.lock()->children.erase(node);
}
node->parents.clear();
graph_ptr->erase(map_iterator);
node->graph_ptr = nullptr;
}
void destroy(std::shared_ptr<Node> node) {
for (auto child : children) {
child->parents.erase(node);
std::cout<<child.use_count()<<std::endl;
if (child.use_count() == 3) {
child->destroy(std::move(child));
}
}
node->children.clear();
for (auto &parent : node->parents) {
parent.lock()->children.erase(node);
}
node->parents.clear();
graph_ptr->erase(map_iterator);
node->graph_ptr = nullptr;
}
};
public:
map_type_ptr graph;
std::shared_ptr<Node> root;
// Tworzy nowy graf. Tworzy takĹźe wÄzeĹ publikacji o identyfikatorze stem_id.
CitationGraph(id_type const &stem_id) {
graph = std::shared_ptr<map_type>(new map_type());
root = std::make_shared<Node>(stem_id, graph);
root->map_iterator = graph->emplace(stem_id, root).first;
}
// Tworzy nowy graf. Tworzy także węzeł publikacji o identyfikatorze stem_id.
CitationGraph(CitationGraph<Publication> &other) = delete;
CitationGraph<Publication> &operator=(CitationGraph<Publication> &other) = delete;
// Konstruktor przenoszący i przenoszący operator przypisania. Powinny być
// noexcept.
CitationGraph(CitationGraph<Publication> &&other) noexcept {
std::swap(graph, other.graph);
root = other.root;
other.root = nullptr;
}
CitationGraph<Publication> &operator=(CitationGraph<Publication> &&other) noexcept {
if (this == &other) {
return *this;
}
std::swap(graph, other.graph);
root = other.root;
other.root = nullptr;
return *this;
}
// Zwraca identyfikator źródła. Metoda ta powinna być noexcept wtedy i tylko
// wtedy, gdy metoda Publication::get_id jest noexcept. Zamiast pytajnika należy
// wpisać stosowne wyrażenie.
id_type
get_root_id() const noexcept(noexcept(std::declval<Publication>().get_id())) {
return root->publication.get_id();
}
// Zwraca listę identyfikatorów publikacji cytujących publikację o podanym
// identyfikatorze. Zgłasza wyjątek PublicationNotFound, jeśli dana publikacja
// nie istnieje.
std::vector<id_type> get_children(id_type const &id) const {
auto it = graph->find(id);
if (it == graph->end()) {
throw PublicationNotFound();
}
std::vector<id_type> ids;
for (auto &child : it->second->children) {
ids.push_back(child->publication.get_id());
}
return ids;
}
// Zwraca listę identyfikatorów publikacji cytowanych przez publikację o podanym
// identyfikatorze. Zgłasza wyjątek PublicationNotFound, jeśli dana publikacja
// nie istnieje.
std::vector<id_type> get_parents(id_type const &id) const {
auto it = graph->find(id);
if (it == graph->end()) {
throw PublicationNotFound();
}
std::vector<id_type> ids;
for (auto &parent : it->second->parents) {
ids.push_back(parent.lock()->publication.get_id());
}
return ids;
}
// Sprawdza, czy publikacja o podanym identyfikatorze istnieje.
bool exists(id_type const &id) const {
return graph->find(id) != graph->end();
}
// Zwraca referencję do obiektu reprezentującego publikację o podanym
// identyfikatorze. Zgłasza wyjątek PublicationNotFound, jeśli żądana publikacja
// nie istnieje.
Publication &operator[](id_type const &id) const {
auto it = graph->find(id);
if (it == graph->end()) {
throw PublicationNotFound();
}
return it->second->publication;
}
// Tworzy węzeł reprezentujący nową publikację o identyfikatorze id cytującą
// publikacje o podanym identyfikatorze parent_id lub podanych identyfikatorach
// parent_ids. Zgłasza wyjątek PublicationAlreadyCreated, jeśli publikacja
// o identyfikatorze id już istnieje. Zgłasza wyjątek PublicationNotFound, jeśli
// któryś z wyspecyfikowanych poprzedników nie istnieje.
void create(id_type const &id, std::vector<id_type> const &parent_ids) {
if (exists(id)) {
throw PublicationAlreadyCreated();
}
if (parent_ids.empty()) {
throw PublicationNotFound();
}
for (auto &parent_id : parent_ids) {
if (!exists(parent_id)) {
throw PublicationNotFound();
}
}
std::weak_ptr<Node> parent_nodes[parent_ids.size()];
for (unsigned int i = 0; i < parent_ids.size(); ++i) {
parent_nodes[i] = graph->at(parent_ids[i]);
}
std::shared_ptr<Node> child_node(new Node(id, graph));
child_node->map_iterator = graph->emplace(id, child_node).first;
try {
for (auto &parent_node: parent_nodes) {
child_node->parents.insert(parent_node);
parent_node.lock()->children.insert(child_node);
}
} catch (...) {
child_node->disconnect(child_node);
throw;
}
}
void create(id_type const &id, id_type const &parent_id) {
create(id, std::vector<id_type>{parent_id});
}
// Dodaje nową krawędź w grafie cytowań. Zgłasza wyjątek PublicationNotFound,
// jeśli któraś z podanych publikacji nie istnieje.
void add_citation(id_type const &child_id, id_type const &parent_id) {
auto it_child = graph->find(child_id);
auto it_parent = graph->find(parent_id);
if (it_child == graph->end() || it_parent == graph->end()) {
throw PublicationNotFound();
}
it_child->second->parents.emplace(it_parent->second);
try {
it_parent->second->children.emplace(it_child->second);
} catch (...) {
it_child->second->parents.insert(it_parent->second);
throw;
}
}
// Usuwa publikację o podanym identyfikatorze. Zgłasza wyjątek
// PublicationNotFound, jeśli żądana publikacja nie istnieje. Zgłasza wyjątek
// TriedToRemoveRoot przy próbie usunięcia pierwotnej publikacji.
void remove(id_type const &id) {
auto it = graph->find(id);
if (it == graph->end()) {
throw PublicationNotFound();
}
if (it->second == root) {
throw TriedToRemoveRoot();
}
it->second->destroy(std::move(it->second));
}
};
#endif //CITATION_GRAPH_H
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars 2/rebelfleet.h
|
<filename>Starwars 2/rebelfleet.h<gh_stars>0
#ifndef MJ394327_JK394387_REBELFLEET_H
#define MJ394327_JK394387_REBELFLEET_H
#include <memory>
#include "assert.h"
#include "helper.h"
#include "imperialfleet.h"
class RebelStarship : public virtual BasicShip {
private:
Speed speed;
public:
RebelStarship(ShieldPoints shieldPoints, Speed speed, Speed minSpeed, Speed maxSpeed) :
BasicShip(shieldPoints),
speed(speed) {
assert(minSpeed <= speed && speed <= maxSpeed);
};
Speed getSpeed() const {
return speed;
}
virtual void beAttacked(ImperialUnit &ship) {
this->takeDamage(ship.getAttackPower());
}
};
class ArmedRebel : public virtual AttackShip, public virtual RebelStarship {
public:
ArmedRebel(ShieldPoints shieldPoints, Speed speed, AttackPower attackPower, Speed minSpeed, Speed maxSpeed) :
AttackShip(attackPower),
BasicShip(shieldPoints),
RebelStarship(shieldPoints, speed, minSpeed, maxSpeed) {};
void beAttacked(ImperialUnit &ship) override {
AttackPower myAttackPower = this->getAttackPower();
this->takeDamage(ship.getAttackPower());
ship.takeDamage(myAttackPower);
}
};
class Explorer : public virtual RebelStarship {
protected:
const static Speed minSpeed;
const static Speed maxSpeed;
public:
Explorer(ShieldPoints shieldPoints, Speed speed) :
BasicShip(shieldPoints),
RebelStarship(shieldPoints, speed, minSpeed, maxSpeed) {};
};
class XWing : public virtual ArmedRebel {
protected:
const static Speed minSpeed;
const static Speed maxSpeed;
public:
XWing(ShieldPoints shieldPoints, Speed speed, AttackPower attackPower) :
AttackShip(attackPower),
BasicShip(shieldPoints),
RebelStarship(shieldPoints, speed, minSpeed, maxSpeed),
ArmedRebel(shieldPoints, speed, attackPower, minSpeed, maxSpeed) {};
};
class StarCruiser : public virtual ArmedRebel {
protected:
const static Speed minSpeed;
const static Speed maxSpeed;
public:
StarCruiser(ShieldPoints shieldPoints, Speed speed, AttackPower attackPower) :
AttackShip(attackPower),
BasicShip(shieldPoints),
RebelStarship(shieldPoints, speed, minSpeed, maxSpeed),
ArmedRebel(shieldPoints, speed, attackPower, minSpeed, maxSpeed) {};
};
std::shared_ptr<Explorer> createExplorer(ShieldPoints shieldPoints, Speed speed);
std::shared_ptr<XWing> createXWing(ShieldPoints shieldPoints, Speed speed, AttackPower attackPower);
std::shared_ptr<StarCruiser> createStarCruiser(ShieldPoints shieldPoints, Speed speed, AttackPower attackPower);
#endif //MJ394327_JK394387_REBELFLEET_H
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/tests/mtest1.c
|
#include "strset.h"
#include "strsetconst.h"
#include <assert.h>
#include <stdio.h>
//#include <string>
//
//using jnp1::strset_new;
//using jnp1::strset_insert;
//using jnp1::strset_delete;
//using jnp1::strset_test;
//using jnp1::strset_remove;
//using jnp1::strset_size;
//using jnp1::strset_comp;
//using jnp1::strset_clear;
//using jnp1::strset42;
int main() {
unsigned long s1, s2, s3, s42;
assert (strset_size(0) == 1);
assert (strset_size(9) == 0);
assert (strset_size(42) == 0);
assert (strset_test(0, "pies") == 0);
assert (strset_test(9, "pies") == 0);
assert (strset_test(42, "pies") == 0);
unsigned long abcsd;
// assert(s42 = strset42());
s1 = strset_new();
assert (s1 != strset42());
s2 = strset_new();
// assert(s42 = strset42());
s3 = strset_new();
assert(strset_size(s1) == 0);
strset_insert(s1, "raz");
assert(strset_size(s1) == 1);
strset_insert(s1, "raz");
assert(strset_size(s1) == 1);
assert(!strset_test(s2, "test"));
strset_insert(s2, "raz");
assert(strset_size(s2) == 1);
assert(strset_comp(s1, s2) == 0);
strset_insert(s2, "dwa");
assert(strset_comp(s1, s2) == 1);
//todo should it be visible?
const char* c_tekst = "asdfghjklqwertyuiopzxcvbnm";
strset_insert(s1, c_tekst);
strset_insert(s1, c_tekst);
assert(strset_size(s1) == 2);
strset_insert(42, c_tekst);
assert(strset_size(strset42()) == 1);
assert(strset_comp(42, s3) == -1);
unsigned long tab[100005];
for (int i = 0; i < 100000; i++) {
tab[i] = strset_new();
strset_insert(tab[i], "dzik");
strset_insert(tab[i], "czupakabra");
strset_insert(tab[i], "pies");
strset_insert(tab[i], "dzida");
}
assert (strset_test(0, "pies") == 0);
assert (strset_test(9, "pies") == 1);
assert (strset_test(strset42(), "pies") == 0);
strset_clear(9);
assert (strset_test(9, "pies") == 0);
assert(strset_comp(tab[1000], tab[99999]) == 0);
strset_clear(tab[1000]);
assert(strset_comp(tab[1000], tab[99999]) == -1);
strset_delete(s1);
strset_delete(s2);
strset_delete(s3);
s1 = strset_new();
assert (s1 != strset42());
s2 = strset_new();
// assert(s42 = strset42());
s3 = strset_new();
strset_insert(s1, "foo");
assert(strset_test(s1, "foo"));
assert(!strset_test(s1, "bar"));
strset_insert(s1, "bar");
assert(strset_test(s1, "bar"));
assert(strset_size(s1) == 2);
strset_insert(s1, "bar");
assert(strset_size(s1) == 2);
strset_remove(s1, "foo");
assert(!strset_test(s1, "foo"));
assert(strset_test(s1, "bar"));
assert(strset_size(s1) == 1);
strset_delete(s1);
strset_insert(s1, "whatever");
assert(strset_size(s1) == 0);
assert(!strset_test(s1, "whatever"));
s2 = strset_new();
s3 = strset_new();
strset_insert(s2, "Ania");
strset_insert(s2, "Alek");
strset_insert(s2, "Maria");
strset_insert(s2, "Fiona");
strset_insert(s3, "Ania");
strset_insert(s3, "Maria");
assert(strset_comp(s2, s3) == -1);
assert(strset_comp(s3, s2) == 1);
strset_remove(s2, "Alek");
strset_remove(s2, "Fiona");
strset_remove(s2, "Olek");
assert(strset_comp(s3, s2) == 0);
strset_clear(s3);
assert(strset_comp(s2, s3) == 1);
strset_clear(s2);
assert(strset_comp(s2, s3) == 0);
strset_delete(s2);
strset_delete(s3);
assert(strset_comp(s2, s3) == 0);
assert(strset_size(strset42()) == 1);
strset_delete(strset42());
strset_insert(strset42(), "66");
assert(strset_size(strset42()) == 1);
strset_insert(strset42(), "24");
strset_insert(strset42(), "42");
assert(!strset_test(strset42(), "24"));
assert(strset_test(strset42(), "42"));
strset_remove(strset42(), "42");
assert(strset_size(strset42()) == 1);
strset_clear(strset42());
assert(strset_size(strset42()) == 1);
assert(strset_comp(strset42(), strset42()) == 0);
strset_delete(s1);
strset_delete(s2);
strset_delete(s3);
strset_delete(42);
for (int i = 0; i < 100000; i++) {
strset_delete(tab[i]);
}
return 0;
}
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars 2/helper.h
|
#ifndef MJ394327_JK394387_HELPER_H
#define MJ394327_JK394387_HELPER_H
#include <cassert>
using ShieldPoints = long long;
using AttackPower = long long;
using Speed = long long;
class Ship {
public:
virtual ~Ship() = default;
virtual ShieldPoints getShield() const = 0;
virtual void takeDamage(AttackPower damage) = 0;
virtual bool isDead() const = 0;
};
class BasicShip : public virtual Ship {
private:
ShieldPoints shieldPoints;
public:
BasicShip(ShieldPoints shieldPoints) : shieldPoints(shieldPoints) {
assert(shieldPoints >= static_cast<ShieldPoints>(0));
}
ShieldPoints getShield() const override {
return shieldPoints;
}
bool isDead() const override {
return shieldPoints == static_cast<ShieldPoints>(0);
}
void takeDamage(AttackPower damage) override {
shieldPoints = damage >= shieldPoints ? 0 : shieldPoints - damage;
}
};
class AttackShipUnit : public virtual Ship {
public:
virtual AttackPower getAttackPower() const = 0;
AttackShipUnit() = default;
};
class AttackShip : public virtual AttackShipUnit {
private:
AttackPower attackPower;
public:
AttackShip(AttackPower attackPower) : attackPower(attackPower) {
assert(attackPower >= static_cast<ShieldPoints>(0));
};
AttackPower getAttackPower() const override {
if (!isDead()) {
return attackPower;
}
else {
return static_cast<AttackPower>(0);
}
}
};
#endif //MJ394327_JK394387_HELPER_H
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/tests/test2.c
|
#include "strsetconst.h"
#include "strset.h"
#include <assert.h>
int main(void) {
//operations on nonexistant sets
{
strset_delete(1);
strset_delete(2);
strset_delete(3);
assert(strset_size(strset42()) == 1);
assert(strset_size(5) == 0);
assert(strset_size(2) == 0);
strset_remove(1, "a");
strset_remove(10123, "42");
strset_remove(0, "......");
assert(strset_test(7, "hello") == 0);
assert(strset_test(9, "test") == 0);
assert(strset_test(9, "") == 0);
strset_clear(1);
strset_clear(2);
strset_clear(6);
assert(strset_comp(123, 1295120) == 0);
assert(strset_comp(1293, 192) == 0);
assert(strset_comp(1230, strset42()) == -1);
}
}
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars/rebelfleet.h
|
#ifndef REBELFLEET_H
#define REBELFLEET_H
#include <type_traits>
#include <cassert>
#include <algorithm>
template <typename U, int minSpeed, int maxSpeed, bool canAttack>
class RebelStarship {
private:
U shield;
U speed;
U attackPower = 0;
public:
using valueType = U;
template <bool b = !canAttack, typename = typename std::enable_if<b>::type>
RebelStarship (U projected_shield, U projected_speed) {
shield = projected_shield;
speed = projected_speed;
assert (minSpeed <= speed && speed <= maxSpeed && shield >= 0);
}
template <bool b = canAttack, typename = typename std::enable_if<b>::type>
RebelStarship (U projected_shield, U projected_speed, U projected_attackPower) {
shield = projected_shield;
speed = projected_speed;
attackPower = projected_attackPower;
assert (minSpeed <= speed && speed <= maxSpeed && shield >= 0);
}
constexpr U getShield() {
return shield;
}
constexpr U getSpeed() {
return speed;
}
template <bool b = canAttack, typename = typename std::enable_if<b>::type>
constexpr U getAttackPower() {
return attackPower;
}
void takeDamage(U damage) {
this->shield -= std::min(shield, damage);
}
static constexpr bool isImperial(){
return false;
}
};
template <typename U>
using Explorer = RebelStarship<U, 299796, 2997960, false>;
template <typename U>
using StarCruiser = RebelStarship<U, 99999, 299795, true>;
template <typename U>
using XWing = RebelStarship<U, 299796, 2997960, true>;
#endif
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars/imperialfleet.h
|
#ifndef IMPERIALFLEET_H
#define IMPERIALFLEET_H
#include <type_traits>
#include <cassert>
#include <algorithm>
#include "rebelfleet.h"
template<typename U>
class ImperialStarship {
private:
U shield;
U attackPower;
public:
using valueType = U;
ImperialStarship(U projected_shield, U projected_attackPower){
shield = projected_shield;
attackPower = projected_attackPower;
assert(shield >= 0);
}
constexpr U getShield() {
return shield;
}
constexpr U getAttackPower() {
return attackPower;
}
void takeDamage(U damage) {
shield -= std::min(shield, damage);
}
static constexpr bool isImperial(){
return true;
}
};
template<typename U>
using TIEFighter = ImperialStarship<U>;
template<typename U>
using ImperialDestroyer = ImperialStarship<U>;
template<typename U>
using DeathStar = ImperialStarship<U>;
template<typename I, typename R>
void attack(ImperialStarship<I> &imperialShip, XWing<R> &rebelShip){
if(rebelShip.getShield() !=0 && imperialShip.getShield() != 0) {
rebelShip.takeDamage(imperialShip.getAttackPower());
imperialShip.takeDamage(rebelShip.getAttackPower());
}
}
template<typename I, typename R>
void attack(ImperialStarship<I> &imperialShip, StarCruiser<R> &rebelShip){
if(rebelShip.getShield() !=0 && imperialShip.getShield() != 0) {
rebelShip.takeDamage(imperialShip.getAttackPower());
imperialShip.takeDamage(rebelShip.getAttackPower());
}
}
template<typename I, typename R>
void attack(ImperialStarship<I> &imperialShip, Explorer<R> &rebelShip){
if(rebelShip.getShield() !=0 && imperialShip.getShield() != 0) {
rebelShip.takeDamage(imperialShip.getAttackPower());
}
}
#endif
|
j-kk/Languages-and-Tools-for-Programming
|
Citation Graph/citation_graph_memory_testing.h
|
<reponame>j-kk/Languages-and-Tools-for-Programming
#define GLIBCXX_FORCE_NEW
#ifndef ZAD5_CITATION_GRAPH_MEMORY_TESTING_H
#define ZAD5_CITATION_GRAPH_MEMORY_TESTING_H
#include <cstdlib>
#include <iostream>
#include <new>
extern long long steps_left_to_throw;
extern bool test_memory;
bool prepare_for_end = false;
size_t allocs = 0;
size_t deallocs = 0;
void* operator new(std::size_t sz){
if (prepare_for_end) {
std::terminate();
}
if (test_memory) {
//fprintf(stderr, "new called");
--steps_left_to_throw;
if (steps_left_to_throw <= 0) {
throw "new exception";
}
}
void *res = std::malloc(sz);
if (res != nullptr) {
++allocs;
}
return res;
}
void operator delete(void* ptr) noexcept{
if (ptr != nullptr) {
++deallocs;
}
if (prepare_for_end && deallocs == allocs) {
fprintf(stderr, "after atexit: delete: memory seems to be successfully freed\n");
}
std::free(ptr);
}
void memCheck() {
fprintf(stderr, "atexit [this can mismatch,"
" atexit is not always called after all frees], "
"you should see one more info if everything is ok: %lu %lu\n", allocs, deallocs);
prepare_for_end = true;
}
#endif //ZAD5_CITATION_GRAPH_MEMORY_TESTING_H
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/tests/test3.c
|
<reponame>j-kk/Languages-and-Tools-for-Programming
#include "strset.h"
#include <assert.h>
//including only strset.h
int main(void) {
unsigned long first = strset_new();
unsigned long second = strset_new();
strset_insert(first, "a");
strset_insert(second, "b");
assert(strset_size(first) == 1);
assert(strset_size(second) == 1);
assert(strset_comp(first, second) == -1);
assert(strset_comp(second, first) == 1);
assert(strset_test(first, "a") == 1);
assert(strset_test(first, "b") == 0);
assert(strset_test(second, "a") == 0);
assert(strset_test(second, "b") == 1);
strset_remove(first, "c");
assert(strset_size(first) == 1);
assert(strset_test(first, "a") == 1);
strset_remove(first, "a");
assert(strset_size(first) == 0);
assert(strset_test(first, "a") == 0);
strset_clear(first);
assert(strset_size(first) == 0);
strset_clear(second);
assert(strset_size(second) == 0);
assert(strset_comp(first, second) == 0);
assert(strset_comp(second, first) == 0);
strset_delete(first);
strset_delete(second);
assert(strset_size(first) == 0);
assert(strset_size(second) == 0);
assert(strset_comp(first, second) == 0);
assert(strset_test(first, "a") == 0);
assert(strset_test(second, "b") == 0);
}
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/strset.h
|
#ifndef STRSET_H
#define STRSET_H
#include <stddef.h>
#ifdef __cplusplus
namespace jnp1 {
extern "C" {
#endif
unsigned long strset_new();
void strset_delete(unsigned long id);
size_t strset_size(unsigned long id);
void strset_insert(unsigned long id, const char *value);
void strset_remove(unsigned long id, const char *value);
int strset_test(unsigned long id, const char *value);
void strset_clear(unsigned long id);
int strset_comp(unsigned long id1, unsigned long id2);
#ifdef __cplusplus
};
}
#endif
#endif //STRSET_H
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/tests/test4.c
|
<reponame>j-kk/Languages-and-Tools-for-Programming
#include "strset.h"
#include "strsetconst.h"
#include <assert.h>
#include <stdlib.h>
//NULL values, changing values
int main(void) {
char foo[4] = "yes";
unsigned long id = strset_new();
assert(id != strset42());
strset_insert(id, foo);
assert(strset_test(id, "yes") == 1);
assert(strset_test(id, foo) == 1);
assert(strset_size(id) == 1);
foo[0] = 'x';
assert(strset_test(id, "yes") == 1);
assert(strset_test(id, "xes") == 0);
assert(strset_test(id, "yes") == 1);
assert(strset_test(id, "") == 0);
strset_insert(id, NULL);
assert(strset_size(id) == 1);
assert(strset_test(id, NULL) == 0);
unsigned long id2 = strset_new();
assert(strset_comp(id, id2) == 1);
for (size_t i = 0; i < 1000; i++) {
strset_insert(id2, "a");
}
assert(strset_size(id2) == 1);
assert(strset_test(id2, "a") == 1);
strset_remove(id2, NULL);
assert(strset_size(id2) == 1);
assert(strset_comp(id, id2) == 1);
strset_clear(id2);
assert(strset_size(id2) == 0);
assert(strset_comp(id2, id) == -1);
strset_remove(100000, NULL);
strset_insert(100000, NULL);
assert(strset_test(100000, NULL) == 0);
}
|
j-kk/Languages-and-Tools-for-Programming
|
Strset/strsetconst.h
|
<filename>Strset/strsetconst.h
#ifndef STRSETCONST_H
#define STRSETCONST_H
#ifdef __cplusplus
namespace jnp1 {
extern "C" {
#endif
unsigned long strset42();
#ifdef __cplusplus
};
}
#endif
#endif //STRSETCONST_H
|
j-kk/Languages-and-Tools-for-Programming
|
Wallet2/wallet.h
|
<filename>Wallet2/wallet.h
#ifndef WALLET_H
#define WALLET_H
#include <algorithm>
#include <chrono>
#include <ctime>
#include <iostream>
#include <string>
#include <sys/time.h>
#include <vector>
using namespace std::rel_ops;
using namespace std;
using unitsB = long long;
class Operation {
unitsB money;
tm date;
chrono::milliseconds time;
public:
Operation(unitsB cash);
~Operation();
string getDate() const;
unitsB getUnits() const;
chrono::milliseconds getTime();
private:
friend ostream &operator<<(ostream &, const Operation &);
friend bool operator<(const Operation &op1, const Operation &op2);
friend bool operator==(const Operation &op1, const Operation &op2);
};
class Wallet {
vector<Operation> history;
static unitsB productedMoney;
const unitsB maxProductedMoney = 2100000000000000;
const unitsB converter = 100000000;
friend Wallet operator+(Wallet &&, Wallet &&);
friend Wallet operator+(Wallet &&, Wallet &);
friend Wallet operator+(Wallet &, Wallet &&) = delete;
friend Wallet operator+(Wallet &, Wallet &) = delete;
friend Wallet operator-(Wallet &&, Wallet &&);
friend Wallet operator-(Wallet &&, Wallet &);
friend Wallet operator-(Wallet &, Wallet &&) = delete;
friend Wallet operator-(Wallet &, Wallet &) = delete;
friend Wallet operator*(const Wallet &, long long n);
friend Wallet operator*(long long n, const Wallet &);
friend Wallet operator*(const Wallet &, int n);
friend Wallet operator*(const Wallet &, long n);
friend Wallet operator*(const Wallet &, unsigned long long n);
friend Wallet operator*(const Wallet &, unsigned long n);
friend Wallet operator*(const Wallet &, unsigned int n);
friend Wallet operator*(unsigned int n, const Wallet &);
friend Wallet operator*(unsigned long n, const Wallet &);
friend Wallet operator*(unsigned long long n, const Wallet &);
friend Wallet operator*(long n, const Wallet &);
friend Wallet operator*(int n, const Wallet &);
friend ostream &operator<<(ostream &, const Wallet &);
friend bool operator<(const Wallet &w1, const Wallet &w2);
friend bool operator==(const Wallet &w1, const Wallet &w2);
friend bool operator!=(const Wallet &w1, const Wallet &w2);
friend bool operator>(const Wallet &w1, const Wallet &w2);
friend bool operator>=(const Wallet &w1, const Wallet &w2);
friend bool operator<=(const Wallet &w1, const Wallet &w2);
template <typename T, typename S> friend Wallet operator*(T, S) = delete;
bool doesItExceed(unitsB units);
void addUnitsToHistory(unitsB units);
void addNewBToHistory(double add);
void multiplyMoney(unitsB money, long long n);
public:
Wallet(long long n = 0);
Wallet(unsigned long int n);
Wallet(unsigned long long int n);
Wallet(unsigned int n);
Wallet(long int n);
Wallet(int n);
explicit Wallet(string s);
explicit Wallet(const char *str);
Wallet(Wallet &&w2);
Wallet(Wallet &w2) = delete;
Wallet(Wallet &&w1, Wallet &&w2);
static Wallet fromBinary(const string &s);
template <typename T> Wallet(T t) = delete;
~Wallet();
Wallet &operator=(Wallet &&w);
Wallet &operator=(Wallet &w) = delete;
Wallet &operator*=(long long n);
Wallet &operator*=(long n);
Wallet &operator*=(unsigned long long n);
Wallet &operator*=(unsigned int n);
Wallet &operator*=(unsigned long n);
Wallet &operator*=(int n);
template <typename T> Wallet &operator*=(T x) = delete;
Wallet &operator+=(Wallet &w);
Wallet &operator+=(Wallet &&w);
Wallet &operator-=(Wallet &w);
Wallet &operator-=(Wallet &&w);
unitsB getUnits() const;
size_t opSize() const;
const Operation operator[](int k) const;
};
const Wallet &Empty();
#endif
|
j-kk/Languages-and-Tools-for-Programming
|
Starwars 2/imperialfleet.h
|
#include <utility>
#ifndef MJ394327_JK394387_IMPERIALFLEET_H
#define MJ394327_JK394387_IMPERIALFLEET_H
#include <vector>
#include <initializer_list>
#include <cassert>
#include <memory>
#include "helper.h"
class ImperialUnit : public virtual AttackShipUnit {
public:
virtual size_t count() = 0;
};
class ImperialStarship : public virtual BasicShip, public virtual AttackShip, public virtual ImperialUnit {
public:
ImperialStarship(ShieldPoints shieldPoints, AttackPower attackPower) :
BasicShip(shieldPoints),
AttackShip(attackPower) {};
size_t count() override {
if (!isDead()) {
return 1;
}
return 0;
}
};
class DeathStar : public virtual ImperialStarship {
public:
DeathStar(ShieldPoints shieldPoints, AttackPower attackPower) :
BasicShip(shieldPoints),
AttackShip(attackPower),
ImperialStarship(shieldPoints, attackPower) {};
};
class ImperialDestroyer : public virtual ImperialStarship {
public:
ImperialDestroyer(ShieldPoints shieldPoints, AttackPower attackPower) :
BasicShip(shieldPoints),
AttackShip(attackPower),
ImperialStarship(shieldPoints, attackPower) {};
};
class TIEFighter : public virtual ImperialStarship {
public:
TIEFighter(ShieldPoints shieldPoints, AttackPower attackPower) :
BasicShip(shieldPoints),
AttackShip(attackPower),
ImperialStarship(shieldPoints, attackPower) {};
};
class Squadron : public ImperialUnit {
private:
std::vector<std::shared_ptr<ImperialUnit> > ships;
public:
Squadron(std::vector<std::shared_ptr<ImperialUnit> > newShips) :
ships(std::move(newShips)) {}
Squadron(std::initializer_list<std::shared_ptr<ImperialUnit> > newShips) :
ships(newShips) {}
size_t count() override {
size_t res = 0;
for (auto &ship: ships) {
if (!ship->isDead()) {
res += ship->count();
}
}
return res;
}
ShieldPoints getShield() const override {
ShieldPoints totalShieldPoints{0};
for (auto &ship: ships) {
totalShieldPoints += ship->getShield();
}
return totalShieldPoints;
}
AttackPower getAttackPower() const override {
AttackPower totalAttackPower{0};
for (auto &ship: ships) {
if (!ship->isDead()) {
totalAttackPower += ship->getAttackPower();
}
}
return totalAttackPower;
}
bool isDead() const override {
return getShield() == static_cast<ShieldPoints>(0);
}
void takeDamage(AttackPower damage) override {
for (auto &ship: ships) {
ship->takeDamage(damage);
}
}
};
std::shared_ptr<DeathStar> createDeathStar(ShieldPoints shieldPoints, AttackPower attackPower);
std::shared_ptr<ImperialDestroyer>
createImperialDestroyer(ShieldPoints shieldPoints, AttackPower attackPower);
std::shared_ptr<TIEFighter> createTIEFighter(ShieldPoints shieldPoints, AttackPower attackPower);
std::shared_ptr<ImperialUnit> createSquadron(std::initializer_list<std::shared_ptr<ImperialUnit>> newShips);
std::shared_ptr<ImperialUnit> createSquadron(std::vector<std::shared_ptr<ImperialUnit>> newShips);
#endif //MJ394327_JK394387_IMPERIALFLEET_H
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework1/DanceFloor.h
|
<filename>Homework1/DanceFloor.h
#ifndef __DANCE__FLOOR__HEADER
#define __DANCE__FLOOR__HEADER
#include "Conga.h"
class DanceFloor {
public:
DanceFloor();
DanceFloor(const DanceFloor& rhs);
DanceFloor& operator=(const DanceFloor& rhs);
~DanceFloor();
void pushBack(const Conga& el);
void popBack();
void removeAt(const size_t index);
void merge(const size_t index1, const size_t index2);
size_t getSize() const;
size_t getCap() const;
bool empty() const;
const Conga& operator[](const size_t index) const;
Conga& operator[](const size_t index);
void print(std::ostream& os) const;
private:
void free();
void copy(const DanceFloor& rhs);
void resize(const int newSize = -1);
private:
Conga* arr;
size_t size;
size_t cap;
};
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework2/Horo.h
|
#pragma once
#include <string>
#include <vector>
#include <list>
using std::string;
using std::vector;
using std::list;
using std::pair;
using std::istream;
class Horo{
private:
struct DancerInfo {
string name;
DancerInfo* leftDancer;
bool isLeftConn;
DancerInfo* rightDancer;
bool isRightConn;
DancerInfo(const string& name,
DancerInfo* leftDancer = nullptr, bool isLeftConn = false,
DancerInfo* rightDancer = nullptr, bool isRightConn = false):
name(name), leftDancer(leftDancer), isLeftConn(isLeftConn),
rightDancer(rightDancer), isRightConn(isRightConn){
}
};
using dancer = DancerInfo*;
using hashChain = list <dancer>;
using hashTable = vector <hashChain>;
using chainIter = hashChain::iterator;
private:
hashTable horo;
static const size_t baseHashSize = 2;
static const size_t maxChainSize = 2; // Change this to 4 later
public:
Horo(size_t size = baseHashSize);
Horo(const Horo& rhs) = delete;
Horo& operator=(const Horo& rhs) = delete;
~Horo();
public:
//Initializing the elements
void insert(const string& newDancer, const string& leftDancer,
const string& rightDancer);
// Add command
void add(const string& newDancer, const string& leftDancer,
const string& rightDancer);
void remove(const string& name);
void release(const string& name, const string& who);
void grab(const string& name, const string& who);
void swap(const string& dancer1, const string& dancer2);
void print(const string& firstDancerName);
void printInfo(const string& name);
// Helpers
void print();
bool empty(const string& firstDancerName);
string getRightName(const string& name);
private:
static size_t hashFunc(const string& name, size_t size);
void rehash();
dancer get(const string& name) ;
chainIter find(size_t index, const string& key);
bool areNeighbors(const dancer leftDancer, const dancer rightDancer) const;
void printRelation(const dancer leftDancer, const dancer rightDancer);
void clearPointers();
};
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Week03/Vector/Vector.h
|
#ifndef __VECTOR__HEADER__
#define __VECTOR__HEADER__
#include <iostream>
template <class T>
class Vector {
public:
Vector();
Vector(const Vector<T>& rhs);
Vector<T>& operator=(const Vector<T>& rhs);
~Vector();
void pushBack(const T& value);
void insertAt(const T& value, const size_t pos);
void popBack();
void RemoveAt(const size_t pos);
int getSize() const;
int search(const T& val);
T& operator[](const int i);
const T& operator[](const int i) const;
private:
//Maybe add a smart resize like Semerdzhiev explained ???
//void reserve();
void resize();
void copy(const Vector<T>& rhs);
void free();
void sort();
int linearSearch(const T& val);
int binarySearch(const T& val);
private:
T* arr;
size_t size;
size_t cap;
bool isSorted;
};
template <class T>
Vector<T>::Vector()
:size(0)
,cap(2)
,arr(nullptr)
,isSorted(false){
this->arr = new T[cap];
}
template <class T>
Vector<T>::Vector(const Vector<T>& rhs){
copy(rhs);
}
template <class T>
Vector<T>& Vector<T>::operator=(const Vector<T>& rhs){
if (this != &rhs){
free();
copy(rhs);
}
return *this;
}
template <class T>
Vector<T>::~Vector(){
free();
}
template <class T>
void Vector<T>::free(){
delete[] arr;
arr = nullptr;
size = 0;
cap = 0;
isSorted = false;
}
template <class T>
void Vector<T>::copy(const Vector<T>& rhs){
this->cap = rhs.cap;
this->size = rhs.size;
isSorted = false;
this->arr = new T[this->cap];
for(size_t i = 0; i < size; i++){
this->arr[i] = rhs.arr[i];
}
}
template <class T>
void Vector<T>::resize(){
T* temp = new T[cap*2];
for(size_t i = 0; i < size; i++){
arr[i] = temp[i];
}
delete[] arr;
arr = temp;
temp = nullptr;
cap *= 2;
}
template <class T>
void Vector<T>::pushBack(const T& value){
if (size >= cap){
resize();
}
arr[size] = value;
size++;
isSorted = false;
}
template <class T>
void Vector<T>::popBack(){
if (size) {
size--;
} else {
//throw an appropriate error
}
//Maybe do a cheeky resize here
}
template <class T>
void Vector<T>::sort(){
T temp;
for(size_t i=1; i < size; i++){
for(size_t j = i - 1; j > 0 && arr[j-1] > arr[j]; j--){
temp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = temp;
}
}
isSorted = true;
}
template <class T>
int Vector<T>::linearSearch(const T& val){
for(int i = 0; i < size; i++){
if (arr[i] == val){
return i;
}
}
return -1;
}
template <class T>
int Vector<T>::binarySearch(const T& val){
int beg = 0;
int end = size;
int middle = (beg + end) / 2 ;
while (beg <= end){
if (arr[middle] > val) //the element is on the left side of the middle
{
end = middle - 1;
middle = (beg + end) / 2;
}
else if (arr[middle] < val) //the element is on the right side of the middle
{
beg = middle + 1;
middle = (beg + end) / 2;
}
else
{
return middle;
}
}
return -1;
}
template <class T>
int Vector<T>::getSize() const{}
template <class T>
T& Vector<T>::operator[](const int i){
if ((i < size)&&(i > 0)){
return arr[i];
}
}
template <class T>
const T& Vector<T>::operator[](const int i) const {
if ((i < size)&&(i > 0)){
return arr[i];
}
}
template <class T>
Vector<T> reverse(const Vector<T>& other){
Vector<T> reversed;
for()
}
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework2/System.h
|
<filename>Homework2/System.h
#pragma once
#include "Horo.h"
class System{
public:
System(const string& filename);
System(const System& rhs) = delete;
System& operator=(const System& rhs) = delete;
~System();
void run();
private:
void updateFirst(const string& name);
void parseFile(const string& filename);
private:
Horo horo;
string firstDancer;
bool isRunning;
};
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework1/Conga.h
|
<filename>Homework1/Conga.h
#ifndef __CONGA__HEADER
#define __CONGA__HEADER
#include "Student.h"
#include "iostream"
class Conga{
public:
Conga();
Conga(const Conga& rhs);
Conga& operator=(const Conga& rhs);
~Conga();
void pushFront(const char* name, const char* uni);
void pushBack(const char* name, const char* uni);
void popFront();
void popBack();
void appendWith(Conga& other);
Conga removeByName(const char* name);
const Student& front() const;
Student& front();
const Student& back() const;
Student& back();
bool empty() const;
size_t getSize() const;
void print(std::ostream& os) const;
private:
void free();
void copy(const Conga& rhs);
private:
struct node{
Student student;
node* nextNode;
node* prevNode;
node(const Student& st, node* prevNode = nullptr, node* nextNode = nullptr):
student(st), nextNode(nextNode), prevNode(prevNode){
}
};
private:
node* frontNode;
node* backNode;
size_t size;
};
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework3/GameMap.h
|
#pragma once
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <fstream>
using std::string;
using std::vector;
using std::pair;
using std::unordered_set;
using std::unordered_map;
using std::queue;
using std::ifstream;
class GameMap{
private:
// representing egde : neighbor zone and key for passing to it
using edge = pair<string, string>;
using adjVerteces = vector<edge>;
using keyHash = unordered_set<string>;
struct Zone{
adjVerteces adjZones;
keyHash keys;
bool isAccessible;
Zone(): isAccessible(false){
}
};
private:
using graph = unordered_map<string, Zone>;
graph gameMap;
public:
GameMap() = default;
GameMap(const GameMap& rhs) = delete;
GameMap& operator=(GameMap& rhs) = delete;
~GameMap() = default;
public:
void parseGameMap(ifstream& file);
void exploreGameMap(const string start);
void generateDOTFile() const;
void printGameMap() const;
private:
void parseZones(ifstream& file);
void parseKeys(ifstream& file);
void bfs(const string start, keyHash& collectedKeys);
};
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Week06/ExamPractice/Window.h
|
<gh_stars>0
#ifndef __Window__HEADER
#define __Window__HEADER
#include <string>
#include <ctime>
using std::string;
class Window{
private:
struct tab{
string url;
time_t timestamp;
tab* nextTab;
tab(const string& newUrl, tab* newNextTab = nullptr){
url = newUrl;
nextTab = newNextTab;
timestamp = time(NULL);
}
};
private:
tab* frontTab;
tab* backTab;
size_t size;
public:
Window();
Window(const Window& rhs);
Window& operator=(const Window& rhs);
~Window();
void pushBack(const string& el);
void handleTab(const string& el);
private:
void free();
void copy(const Window& rhs);
void removeAfterLast(const tab* tab);
tab* findTab(const string& el);
};
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework1/System.h
|
#ifndef __SYSTEM__HEADER
#define __SYSTEM__HEADER
#include "DanceFloor.h"
class System{
public:
System();
void run();
private:
void appendF(const char* name, const char* uni, size_t index);
void removeLastF(size_t index);
void removeFirstF(size_t index);
void removeF(const char* name, size_t index);
void mergeF(size_t index1, size_t index2);
size_t charToInt(const char* str);
private:
DanceFloor floor;
bool isRunning;
};
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Week07/SortStudentGradesTask/Student.h
|
<filename>Week07/SortStudentGradesTask/Student.h<gh_stars>0
#ifndef __STUDENT__GRADE__HEADER
#define __STUDENT__GRADE__HEADER
#include <string>
#include <iostream>
using std::string;
using std::ostream;
using std::istream;
struct Student{
string name;
string subject;
string date;
unsigned short age;
unsigned short grade;
friend ostream& operator<<(ostream& out, const Student& data)
{
out << data.name << ',' << data.age << ',' << data.subject
<< ',' << data.grade << ',' << data.date << '\n';
return out;
}
friend istream& operator>>(istream& in, Student& data)
{
string age, grade;
getline(in, data.name, ',');
getline(in, age, ',');
data.age = atoi(age.c_str());
getline(in, data.subject, ',');
getline(in, grade, ',');
data.grade = atoi(grade.c_str());
getline(in, data.date, '\n');
return in;
}
};
#endif
|
Stoefff/Data-Structures-and-Algorithms-2018
|
Homework1/Student.h
|
#ifndef __STUDENT__HEADER
#define __STUDENT__HEADER
#include <iostream>
//add to lower function
class Student{
public:
Student() = delete;
Student(const char* name, const char* uni);
Student(const Student& rhs);
Student& operator=(const Student& rhs);
~Student();
void print(std::ostream& os) const;
bool isFriend(const Student& other) const;
bool sameNames(const char* name) const;
private:
void free();
void copy(const Student& rhs);
bool validUni(const char* uni) const;
private:
char* name;
//Shoud be ENUM, refactor this later
char* uni;
};
#endif
|
m-colombo/cppML
|
src/learners/stop/stop_criteria.h
|
//
// stop_criteria.h
// XAA1
//
// Created by <NAME> on 14/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef XAA1_stop_criteria_h
#define XAA1_stop_criteria_h
#include "../backprop_learner.h"
#include <string>
namespace Stop {
class MaxIteration : public Criteria{
public:
int iteration = 0;
MaxIteration(int iteration) : iteration(iteration){};
bool hasToStop(BackPropagation const& learner) override;
std::string stopMessage() override;
std::string getInfo() override;
};
class TrainingConvergence : public Criteria{
public:
double abs_error_threshold = 0;
TrainingConvergence(double abs_error_threshold) : abs_error_threshold(abs_error_threshold) {};
bool hasToStop(BackPropagation const& learner) override;
std::string stopMessage() override;
std::string getInfo() override;
};
class TrainingDivergence : public Criteria{
public:
double abs_error_threshold = 0;
int initial_iteration_to_skip, check_every;
TrainingDivergence(double abs_error_threshold, int initial_iteration_to_skip = 50, int check_every = 10) : abs_error_threshold(abs_error_threshold), initial_iteration_to_skip(initial_iteration_to_skip),check_every(check_every) {};
bool hasToStop(BackPropagation const& learner) override;
std::string stopMessage() override;
std::string getInfo() override;
};
// Simple because doesn't store the best model, it just compares error
class SimpleEarlyStop : public Criteria{
public:
double last_test_error = INFINITY, minimum_error_improvement;
int iteration_to_wait, initial_iteration_to_skip = 200;
SamplesSP test;
std::shared_ptr<Loss> targetLoss;
SimpleEarlyStop(double minimum_error_improvement, int initial_iteration_to_skip, int iteration_to_wait, SamplesSP test, std::shared_ptr<Loss> targetLoss) :
minimum_error_improvement(minimum_error_improvement),
iteration_to_wait(iteration_to_wait),
initial_iteration_to_skip(initial_iteration_to_skip),
test(test),
targetLoss(targetLoss){}
bool hasToStop(BackPropagation const& learner) override;
std::string stopMessage() override;
std::string getInfo() override;
};
}
#endif
|
m-colombo/cppML
|
src/data/samples.h
|
<filename>src/data/samples.h<gh_stars>0
//
// samples.h
// XAA1
//
// Created by <NAME> on 18/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef XAA1_samples_h
#define XAA1_samples_h
#include <deque>
#include <string>
#include <memory>
#include <iterator>
#include <random>
typedef std::deque<double> Doubles;
struct Sample{
Doubles input;
Doubles output;
std::string sample_id;
};
typedef std::deque<Sample> Samples;
typedef std::shared_ptr<Samples> SamplesSP;
class SamplesPermutationIterator;
class SamplesPermutation {
static std::minstd_rand0 rand;
SamplesSP samples;
std::deque<size_t> permutation;
public:
SamplesPermutation(SamplesSP const & samples) : samples(samples), permutation(getPermutation(samples->size())){}
static std::deque<size_t> getPermutation(size_t size);
SamplesPermutationIterator begin();
SamplesPermutationIterator end();
};
class SamplesPermutationIterator : public std::iterator<std::forward_iterator_tag, const Sample>{
size_t idx = 0;
std::deque<size_t>& permutation;
SamplesSP const & samples;
public:
SamplesPermutationIterator(SamplesSP const & samples, std::deque<size_t> & permutation) : samples(samples), permutation(permutation){};
SamplesPermutationIterator(const SamplesPermutationIterator& it) = default;
SamplesPermutationIterator& operator++() {++idx;return *this;}
SamplesPermutationIterator operator++(int) {SamplesPermutationIterator tmp(*this); ++*this; return tmp;}
bool isEnd() const {return idx >= permutation.size();}
void goToEnd(){ idx = permutation.size();}
void goToBegin(){ idx = 0; }
bool operator==(const SamplesPermutationIterator& it) {return (idx == it.idx || (isEnd() && it.isEnd())) && &permutation == &(it.permutation);}
bool operator!=(const SamplesPermutationIterator& it) {return !operator==(it);}
Sample const& operator*() {return (*samples)[permutation[idx]];}
};
struct Result{
Doubles outputs;
std::string sample_id;
};
typedef std::deque<Result> Results;
#endif
|
m-colombo/cppML
|
src/data/data_normalization.h
|
//
// data_normalization.h
// XAA1
//
// Created by <NAME> on 16/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__data_normalization__
#define __XAA1__data_normalization__
#include "samples.h"
#include "../selection/model_info.h"
//TODO extend for 1-of-k
class DataNormalizer : public ModelInfo{
public:
virtual double normalize(double value) = 0;
virtual double denormalize(double value) = 0;
virtual void setDataSource(Doubles const& values)=0;
virtual ~DataNormalizer()=default;
};
typedef std::shared_ptr<DataNormalizer> DataNormalizerSP;
class MinMaxNormalizer : public DataNormalizer{
public:
MinMaxNormalizer(double min_target, double max_target);
void setDataSource(Doubles const& values) override;
double normalize(double value) override;
double denormalize(double value) override;
std::string getInfo() override {return "MinMax["+std::to_string(min_target)+","+std::to_string(max_target)+"]";}
protected:
double min_target, max_target;
double min_value, max_value;
};
class IdentityNormalizer : public DataNormalizer{
public:
IdentityNormalizer(){};
void setDataSource(Doubles const& values) override {}
double normalize(double value) override {return value;}
double denormalize(double value) override {return value;}
std::string getInfo() override {return "Identity";}
};
class ZNormalizer : public DataNormalizer{
public:
ZNormalizer()=default;
void setDataSource(Doubles const& values) override;
double normalize(double value) override { return (value - mean) / sd;}
double denormalize(double value) override { return (value * sd) + mean;}
std::string getInfo() override {return "Z";}
protected:
double mean, sd;
};
#endif /* defined(__XAA1__data_normalization__) */
|
m-colombo/cppML
|
src/examples/monks/monks-interface.h
|
<gh_stars>0
//
// monks-interface.h
// XAA1
//
// Created by <NAME> on 11/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__monks_interface__
#define __XAA1__monks_interface__
#include "../../data/samples.h"
class Monks{
public:
Monks()=default;
std::shared_ptr<Samples> samples;
void LoadFile(std::string const& fileName);
private:
const int attribute_max_value[6] = {3,3,2,3,4,2};
};
#endif /* defined(__XAA1__monks_interface__) */
|
m-colombo/cppML
|
src/util.h
|
#ifndef __ML_UTIL__
#define __ML_UTIL__
#include <string>
double rand_in_range(double a, double b);
std::string createAndGetRunFolder(std::string const & parent);
std::string createSubFolder(std::string const & parent, std::string const & sub);
#endif
|
m-colombo/cppML
|
src/learners/loss/loss.h
|
<filename>src/learners/loss/loss.h
//
// loss.h
// XAA1
//
// Created by <NAME> on 17/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__loss__
#define __XAA1__loss__
#include "../../selection/model_info.h"
#include "../../data/sample_normalization.h"
class Loss : public ModelInfo {
public:
virtual double sampleError(Doubles const & outs, Doubles const & target) = 0;
};
typedef std::shared_ptr<Loss> LossSP;
class DifLoss : public Loss{
public:
virtual double derivativeOnOut(Doubles const & outs, Doubles const & targets, int index) = 0;
};
class DenormalizedLoss : public Loss {
SampleNormalizer denormalizer;
std::shared_ptr<Loss> loss;
public:
DenormalizedLoss(SampleNormalizer const & denormalizer, std::shared_ptr<Loss> loss) :
loss(loss),
denormalizer(denormalizer)
{}
double sampleError(Doubles const & outs, Doubles const & targets) override {
return loss->sampleError(denormalizer.denormalizeOutput(outs), denormalizer.denormalizeOutput(targets));
};
std::string getInfo() override {return "Denormalized " + loss->getInfo();}
};
class MeanSquaredError : public DifLoss{
public:
MeanSquaredError()=default;
double sampleError(Doubles const & outs, Doubles const & targets) override;
double derivativeOnOut(Doubles const & outs, Doubles const & targets, int index) override;
std::string getInfo() override {return "Mean squared error";}
};
class MeanEuclideanError : public DifLoss{
public:
MeanEuclideanError()=default;
double sampleError(Doubles const & outs, Doubles const & targets) override;
double derivativeOnOut(Doubles const & outs, Doubles const & target, int index) override;
std::string getInfo() override {return "Mean euclidean error";}
};
class MisclassificationRatio1ofK : public Loss{
public:
MisclassificationRatio1ofK()=default;
double sampleError(Doubles const & outs, Doubles const & targets) override;
std::string getInfo() override {return "Classification precision";}
};
#endif /* defined(__XAA1__loss__) */
|
m-colombo/cppML
|
src/selection/model_selection.h
|
<filename>src/selection/model_selection.h
//
// model_selection.h
// XAA1
//
// Created by <NAME> on 22/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__model_selection__
#define __XAA1__model_selection__
#include "../data/samples.h"
#include "../learners/backprop_learner.h"
#include "../data/data_normalization.h"
#include "../selection/scorers/scorer.hpp"
#include<functional>
class GridSearchHoldOutCV{
public:
std::string results_dir;
//Search parameters
std::shared_ptr<Loss> targetLoss;
int trials = 1;
std::shared_ptr<Scorer::IScorer> modelScoreMethod;
//When stop criteria depends on the normalization methods they can be generated
std::function<std::deque<std::shared_ptr<Stop::Criteria>>(SamplesSP normalized_selection, std::shared_ptr<DenormalizedLoss> dloss)> stopCriteriaGen;
std::deque<std::shared_ptr<Stop::Criteria>> stopCriteria;
//TODO allow observers
//Hyper parameters to select
std::deque<SampleNormalizer> normalizers;
std::deque<std::shared_ptr<FeedforwardNetwork>> topologies;
std::deque<std::pair<double,double>> initialWeights;
std::deque<std::shared_ptr<DifLoss>> gradientLoss;
std::deque<double> batchRatios, learningRates, momentums, weightDecays;
//Data to use
SamplesSP train, selection;
//Split data in training and selection
GridSearchHoldOutCV(Samples const& original_data, double train_ratio, std::string const& results_dir);
GridSearchHoldOutCV(std::shared_ptr<Samples> train, std::shared_ptr<Samples> selection, std::string const& results_dir);
template<class T_LOSS>
void setTargetLoss(T_LOSS const & loss){
targetLoss = std::make_shared<T_LOSS>(loss);
}
template<class T_IN, class T_OUT>
void addNormalizer(T_IN const& input_protoype, T_OUT const& output_prototype){
SampleNormalizer sn;
sn.initialize(*train, input_protoype, output_prototype);
normalizers.push_back(sn);
}
template<class T_HIDDEN, class T_OUT>
void addTopologies (std::deque<std::deque<int>> const& hidden_layers){
for(auto& h : hidden_layers)
topologies.push_back(FeedforwardNetwork::build<T_HIDDEN, T_OUT>(train->at(0).input.size(), h, (int)train->at(0).output.size()));
}
template<class T_LOSS>
void addGradientLoss(){
gradientLoss.push_back(std::make_shared<T_LOSS>());
}
size_t getTotalModels();
void search(int process_number=0,int process_total = 1);
};
#endif /* defined(__XAA1__model_selection__) */
|
m-colombo/cppML
|
src/neurons/logistic_neuron.h
|
<filename>src/neurons/logistic_neuron.h
//
// logistic_neuron.h
// XAA1
//
// Created by <NAME> on 11/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__logistic_neuron__
#define __XAA1__logistic_neuron__
#include "neuron.h"
class LogisticNeuron : public NetNeuron{
public:
double slope = 1;
LogisticNeuron()=default;
double activationFunction(double x) override;
double activationDerivative(double x) override;
std::string getInfo() override {return "Logistic slope " + std::to_string(slope);}
};
class TanhNeuron : public NetNeuron{
public:
double slope = 1;
TanhNeuron()=default;
double activationFunction(double x) override;
double activationDerivative(double x) override;
std::string getInfo() override {return "Tanh slope " + std::to_string(slope);}
};
#endif /* defined(__XAA1__logistic_neuron__) */
|
m-colombo/cppML
|
src/examples/monks/task-monks.h
|
#ifndef __MONKS__
#define __MONKS__
#include <string>
void Learn_Monks1(std::string const& data_dir, std::string const& out_dir);
void Learn_Monks2(std::string const& data_dir, std::string const& out_dir);
void Learn_Monks3(std::string const& data_dir, std::string const& out_dir);
#endif
|
m-colombo/cppML
|
src/neurons/neuron.h
|
<filename>src/neurons/neuron.h<gh_stars>0
#ifndef NEURON_H
#define NEURON_H
#include <unordered_map>
#include <memory>
#include "../selection/model_info.h"
class Neuron {
public:
double net = 0;
double output = 0;
int layer = 0;
//Error correction term: [d\d(out) Error(out)] * [d/dx activation(x)]
double delta = 0;
bool isOut = false;
double targetOut = 0;
Neuron()=default;
virtual ~Neuron()=default;
virtual double computeNet(){return 0;}
virtual double computeOut(){return 0;}
};
struct Weight{
double weight; //Current value
double lastDelta; //Last update needed for momentum
double nextDelta; //Accumulator for batch updates
Weight(double w = 0.0) : weight(w), lastDelta(0.0), nextDelta(0.0) { }
};
typedef std::shared_ptr<Neuron> NeuronSP;
typedef std::unordered_map<NeuronSP, Weight> NeuronSPxWeight;
class DataNeuron : public Neuron{
public:
DataNeuron()=default;
void setData(double data){output=data;}
double computeOut() override {return output;}
};
typedef std::shared_ptr<DataNeuron> DataNeuronSP;
class NetNeuron : public Neuron, public ModelInfo{
public:
Weight bias;
NeuronSPxWeight NW; //input connections
//Return the new this.layer
virtual int connectTo(NeuronSP neuron, Weight weight);
double computeNet() override;
double computeOut() override;
virtual double activationFunction(double x) = 0;
virtual double activationDerivative(double x) = 0;
};
typedef std::shared_ptr<NetNeuron> NetNeuronSP;
//Used for regression output
class LinearNeuron : public NetNeuron{
public:
double activationFunction(double x) override{return x;}
double activationDerivative(double x) override {return 1;};
std::string getInfo() override {return "Identity";}
};
#endif
|
m-colombo/cppML
|
src/data/sample_normalization.h
|
//
// sample_normalization.h
// XAA1
//
// Created by <NAME> on 29/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef __XAA1__sample_normalization__
#define __XAA1__sample_normalization__
#include "samples.h"
#include "data_normalization.h"
#include <cassert>
#include "../selection/model_info.h"
class SampleNormalizer : public ModelInfo{
std::deque<DataNormalizerSP> input_normalizers, output_normalizers;
public:
SampleNormalizer()=default;
//TODO a normalizer type per features
template<class T_IN, class T_OUT>
void initialize(Samples const & data, T_IN const& input_prototype, T_OUT const& output_prototype){
std::deque<Doubles> input_features(data[0].input.size());
std::deque<Doubles> output_features(data[0].output.size());
//Collect feature values from samples list. (Rows list to cols list)
for(auto& s : data){
assert(s.input.size() == input_features.size() && s.output.size() == output_features.size());
auto s_inp_it = s.input.begin();
auto feature_inp_it = input_features.begin();
for(;s_inp_it != s.input.end(); s_inp_it++, feature_inp_it++)
feature_inp_it->push_back(*s_inp_it);
auto s_out_it = s.output.begin();
auto feature_out_it = output_features.begin();
for(;s_out_it != s.output.end(); s_out_it++, feature_out_it++)
feature_out_it->push_back(*s_out_it);
}
input_normalizers.clear(); output_normalizers.clear();
for(auto& i : input_features){
auto n = std::make_shared<T_IN>(input_prototype);
n->setDataSource(i);
input_normalizers.push_back(n);
}
for(auto& o : output_features){
auto n = std::make_shared<T_OUT>(output_prototype);
n->setDataSource(o);
output_normalizers.push_back(n);
}
}
//TODO extend for 1-of-k
Doubles normalizeInput(Doubles const & input) const;
Doubles normalizeOutput(Doubles const & output) const;
Doubles denormalizeInput(Doubles const & input) const;
Doubles denormalizeOutput(Doubles const & output) const;
Samples normalizeDataset(Samples const & data) const;
Samples denormalizeDataset(Samples const & data) const;
std::string getInfo() override;
};
#endif /* defined(__XAA1__sample_normalization__) */
|
m-colombo/cppML
|
src/networks/feedforward_network.h
|
<gh_stars>0
#ifndef NETWORK_H
#define NETWORK_H
#include "../neurons/neuron.h"
#include "../data/samples.h"
#include "../util.h"
#include "../learners/loss/loss.h"
#include "../selection/model_info.h"
#include <deque>
#include <map>
#include <algorithm>
typedef std::deque<DataNeuronSP> DataLayer;
typedef std::multimap<int,NetNeuronSP> Layers;
typedef std::deque<NetNeuronSP> OutLayer;
class FeedforwardNetwork : public ModelInfo{
public:
DataLayer inputs;
Layers layers;
OutLayer outs;
FeedforwardNetwork(size_t inputsNumber);
void setSample(Sample const& sample);
void propagateInput();
Doubles getOutputs();
Doubles getTargetOuts();
void randomizeWeights(double min, double max);
// T is constrained to be an iterable of NeuronSP compatible type
template<class T>
void addNeuron(NetNeuronSP n, const T& inputs, Doubles const& Ws){
int layer = 0;
auto i1 = inputs.begin();
auto i2 = Ws.begin();
for(; i1 != inputs.end() && i2 != Ws.end(); i1++, i2++){
layer = std::max(n->connectTo(*i1, Weight{*i2}), layer);
}
if(n->isOut)
outs.push_back(n);
else
layers.insert(make_pair(layer,n));
}
// T is constrained to be an iterable of NeuronSP compatible type
template<class T>
void addNeuron(NetNeuronSP n, const T& inputs){
Doubles ws;
for(int i = 0; i < inputs.size(); i++)
ws.push_back(0);
addNeuron(n, inputs, ws);
}
//Util to build a multi layer network
template<class T_HIDDEN, class T_OUT>
static std::shared_ptr<FeedforwardNetwork> build(size_t input, std::deque<int> hiddens, int output){
auto N = std::make_shared<FeedforwardNetwork>(input);
std::deque<NetNeuronSP> previousLayer;
bool isFirst = true;
for(int hn : hiddens){
std::deque<NetNeuronSP> layer;
for(int i=0; i < hn; i++){
auto n = std::make_shared<T_HIDDEN>();
layer.push_back(n);
if(isFirst)
N->addNeuron(n, N->inputs);
else
N->addNeuron(n, previousLayer);
}
previousLayer = layer;
isFirst = false;
}
for(int i = 0; i < output; i++){
auto n = std::make_shared<T_OUT>();
n->isOut = true;
N->addNeuron(n, previousLayer);
}
return N;
}
double testDataSet(Samples const & dataset, Loss & loss);
Results evaluateDataSet(Samples const & data, SampleNormalizer const & denormalizer);
std::string getInfo() override;
private:
//TODO copy constructor
//Network represented with shared_ptr can't be copied straight forward
FeedforwardNetwork(FeedforwardNetwork & n) = delete;
};
#endif
|
m-colombo/cppML
|
src/learners/observer/observer.h
|
//
// observer.h
// XAA1
//
// Created by <NAME> on 08/01/2016.
// Copyright (c) 2016 <NAME>. All rights reserved.
//
#ifndef __XAA1__observer__
#define __XAA1__observer__
#include "../backprop_learner.h"
#include <fstream>
namespace Observer{
class IterationError : public IObserver{
std::ofstream outf;
std::string outfn;
SamplesSP data;
std::shared_ptr<Loss> loss;
public:
IterationError(std::string const& out_file, SamplesSP data, std::shared_ptr<Loss> loss) : outfn(out_file), data(data), loss(loss){}
void preLearn(BackPropagation const& learner) override {
outf.open(outfn);
};
void postLearn(BackPropagation const& learner) override {
outf.close();
};
void postIteration(BackPropagation const& learner) override;
};
}
#endif /* defined(__XAA1__observer__) */
|
m-colombo/cppML
|
src/selection/model_info.h
|
//
// IInfo.h
// XAA1
//
// Created by <NAME> on 31/12/2015.
// Copyright (c) 2015 <NAME>. All rights reserved.
//
#ifndef XAA1_model_info_h
#define XAA1_model_info_h
#include <string>
class ModelInfo{
public:
virtual std::string getInfo()=0;
};
#endif
|
m-colombo/cppML
|
src/learners/backprop_learner.h
|
#ifndef _BACKPROP_H
#define _BACKPROP_H
#include "../networks/feedforward_network.h"
#include "../learners/loss/loss.h"
#include <limits>
class BackPropagation;
namespace Stop {
class Criteria : public ModelInfo{
public:
virtual bool hasToStop(BackPropagation const& learner) = 0;
virtual std::string stopMessage() = 0;
//Allows to reuse criteria objects across different runs
virtual void reset() {};
};
}
namespace Observer {
class IObserver{
public:
virtual void preLearn(BackPropagation const& learner){};
virtual void postLearn(BackPropagation const& learner){};
virtual void postIteration(BackPropagation const& learner){};
};
}
class BackPropagation{
public:
int current_iteration = 0;
double iteration_error = std::numeric_limits<double>::infinity() ;
Loss &taskLoss;
DifLoss &gradientLoss;
FeedforwardNetwork &N;
double learning_rate = 0.01, momentum = 0, weight_decay = 0;
BackPropagation(FeedforwardNetwork & network, DifLoss& gradientLoss, Loss& taskLoss, double batchRatio = 1);
void learn(std::shared_ptr<Samples>& train, std::pair<double,double> initial_weight_range = std::pair<double,double>(-0.25, 0.25));
bool hasToStop();
std::deque<std::shared_ptr<Stop::Criteria>> StopCriteria;
std::shared_ptr<Stop::Criteria> Stopper; //Stop criteria which made learning stops
std::deque<std::shared_ptr<Observer::IObserver>> observers;
void setBatchRatio(double r){ batchSize = (size_t)( TR->size() * std::min(1.0,r)); }
protected:
double batchRatio = 1;
size_t batchSize;
std::shared_ptr<Samples> TR; //TODO const constraints
void iteration(SamplesPermutationIterator & TR_it);
void backPropagateError(NetNeuronSP const &n);
void applyWeightsCorrection(NetNeuronSP const &n);
};
#endif
|
NikelWolf/mirea_schedule
|
scheduler/include/xlsx_file.h
|
<gh_stars>0
#pragma once
#include "common.h"
namespace scheduler {
class XlsxFile {
public:
struct XlsxCell {
string value{};
bool __was_changed = false;
};
explicit XlsxFile(const string &filename);
XlsxFile(const XlsxFile &file);
virtual ~XlsxFile();
schedule_index_t get_max_row_index() const;
schedule_index_t get_max_column_index() const;
const vector<vector<XlsxCell>> &get_rows() const;
const vector<XlsxCell> &get_row(uint64_t index) const;
const string &get_cell(schedule_index_t row, schedule_index_t column) const;
void set_cell(schedule_index_t row, schedule_index_t column, const string &value);
const string &get_file_name() const;
void set_file_name(const string &new_filename);
void load_new_file(const string &filename);
void write_as(const string &new_filename);
void write();
void save();
void discard_saving();
private:
bool _file_was_changed = false;
bool _file_was_saved = false;
string _filename;
Document *_document;
vector<vector<XlsxCell>> _xlsx_info{};
schedule_index_t _max_row{}, _max_column{};
void _load_xlsx_into_info();
void _check_indices(schedule_index_t row, schedule_index_t column) const;
};
}
|
NikelWolf/mirea_schedule
|
scheduler/include/scheduler.h
|
<reponame>NikelWolf/mirea_schedule
#pragma once
#include "common.h"
namespace scheduler {
class Scheduler {
public:
Scheduler();
explicit Scheduler(const string &file_name);
bool is_group_in_schedule(const string &group_name) const;
const string &get_schedule_filename() const;
void set_schedule_filename(const string &filename);
void open_new_schedule(const string &filename);
void create_new_empty_schedule(const string &filename);
const vector<GroupSchedule> &get_groups() const;
const GroupSchedule &get_group(const string &group_name) const;
void add_group(const GroupSchedule &gs);
void remove_group(const string &group_name);
const string &get_cource_metainfo() const;
void set_cource_metainfo(const string &metainfo_string);
const string &get_confirmation_metainfo() const;
void set_confirmation_metainfo(const string &metainfo_string);
const pair<string, string> get_UMD_head_metainfo() const;
void set_UMD_head_metainfo(const pair<string, string> &metainfo);
const pair<string, string> get_headmaster_metainfo() const;
void set_headmaster_metainfo(const pair<string, string> &metainfo);
void save_schedule();
void save_schedule_as(const string &filename);
string to_string() const;
friend ostream &operator<<(ostream &os, const Scheduler &scheduler);
vector<GroupSchedule> &get_groups_non_const_ref() const;
GroupSchedule &get_group_non_const_ref(const string &group_name) const;
private:
const static string _default_schedule_template_filename;
const static string _default_schedule_filename;
const static uint8_t _max_groups_count;
XlsxFile _schedule;
schedule_index_t _schedule_start_row, _schedule_start_col;
vector<GroupSchedule> _groups{};
string _schedule_date_and_course_metainfo;
string _confirmation_metainfo;
pair<string, string> _UMD_head_metainfo;
pair<string, string> _headmaster_metainfo;
schedule_index_t _get_group_name_row() const;
void _fill_schedule_start_position();
void _clear_attributes();
int _get_group_index(const string &group_name) const;
bool _check_for_free_day(pair<schedule_index_t, schedule_index_t> start_position) const;
Lesson _fill_lesson(pair<schedule_index_t, schedule_index_t> start_position) const;
void _parse_metainfo_for_group(GroupSchedule &gs, pair<schedule_index_t, schedule_index_t> start_position);
void _parse_schedule_for_group(GroupSchedule &gs, pair<schedule_index_t, schedule_index_t> start_position);
void _parse_schedule_metainfo();
void _parse_schedule();
void _load_schedule_metainfo_into_file();
void _load_single_group_into_file(GroupSchedule &gs, schedule_index_t group_row,
schedule_index_t group_start_position);
void _load_groups_into_file();
};
}
|
NikelWolf/mirea_schedule
|
scheduler/include/common.h
|
<gh_stars>0
#pragma once
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <regex>
#include <unordered_map>
#include <algorithm>
#include <cstdint>
#include <xlsxdocument.h>
using namespace std;
using namespace QXlsx;
namespace scheduler {
class Lesson;
using schedule_index_t = uint64_t;
using day_template = unordered_map<int, Lesson>;
using week_template = unordered_map<int, day_template>;
using parity_week_template = unordered_map<int, week_template>;
void string_ltrim_ref(string &s);
void string_rtrim_ref(string &s);
void string_trim_ref(string &s);
string string_ltrim(string s);
string string_rtrim(string s);
string string_trim(string s);
vector<string> string_split(const string &input, const string ®ex);
string string_join(vector<string> &strings, const string &connector);
}
#include "schedule_error.h"
#include "lesson.h"
#include "xlsx_file.h"
#include "group_schedule.h"
#include "scheduler.h"
|
NikelWolf/mirea_schedule
|
include/WLesson.h
|
#ifndef WLESSON_H
#define WLESSON_H
#include <QtWidgets>
#include "scheduler.h"
using namespace std;
using namespace scheduler;
const unsigned int h = 71;
constexpr QSize lesSize[] = {
{30, h}, //пара 0
{40, h}, //нач/кон зан 1
{30, h / 2}, //четность 2
{210, h / 2}, //предмет 3
{40, h / 2}, //вид занятий 4
{120, h / 2}, //фио 5
{55, h / 2}, //кабинет 6
};
class WLesson : public QWidget {
Q_OBJECT
private:
array<QLabel *, 5> labels;
QGridLayout *labelsLayout;
QGridLayout *textLayout;
void createWidgets(int lessonNumber, QStringList &time);
public:
array<QTextEdit *, 8> textEdits;
//0 2 4 6
//1 3 5 7
WLesson(int lessonNumber, QStringList &time, QWidget *parent = nullptr);
~WLesson() override = default;
void setSubject(int parity, QString name);
void setType(int parity, QString name);
void setProfessor(int parity, QString name);
void setRoom(int parity, QString name);
QString getSubject(int parity);
QString getType(int parity);
QString getProfessor(int parity);
QString getRoom(int parity);
};
#endif // WLESSON_H
|
NikelWolf/mirea_schedule
|
scheduler/include/group_schedule.h
|
#pragma once
#include "common.h"
namespace scheduler {
class GroupSchedule {
public:
GroupSchedule();
explicit GroupSchedule(string group_name);
virtual ~GroupSchedule() = default;
static bool is_group_name_valid(const string &group_name);
const string &get_group_name() const;
void set_group_name(const string &group_name);
const string &get_group_faculty() const;
void set_group_faculty(const string &group_faculty);
const string &get_group_magic_number() const;
void set_group_magic_number(const string &group_magic_number);
const Lesson &get_lesson(int parity, int day, int lesson_number) const;
void set_lesson(int parity, int day, int lesson_number, const Lesson &lesson);
void add_addition_message(const string &message, int day_number);
string to_string() const;
friend ostream &operator<<(ostream &os, const GroupSchedule &gs);
Lesson &get_lesson_non_const_ref(int parity, int day, int lesson_number) const;
private:
const static regex _group_name_template;
string _group_name;
string _group_faculty;
string _group_magic_number; // I don't know what this number means
parity_week_template _group_schedule;
void _create_group_schedule_template();
void _check_parity_day_and_lesson(int parity, int day, int lesson) const;
};
}
|
NikelWolf/mirea_schedule
|
include/Logger.h
|
<filename>include/Logger.h
#ifndef LOGGER_H
#define LOGGER_H
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include <QDebug>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(log)
Q_DECLARE_LOGGING_CATEGORY(gui)
Q_DECLARE_LOGGING_CATEGORY(db)
Q_DECLARE_LOGGING_CATEGORY(parse)
class Logger : public QObject {
Q_OBJECT
private:
static QScopedPointer<QFile> logFile;
static void messageHandler(QtMsgType type,
const QMessageLogContext &context,
const QString &msg);
public:
explicit Logger(QObject *parent = nullptr);
void writeLog(const QString &message,
const QLoggingCategory &log, QtMsgType type = QtInfoMsg);
signals:
public slots:
};
#endif // LOGGER_H
|
NikelWolf/mirea_schedule
|
scheduler/include/lesson.h
|
#pragma once
#include "common.h"
using namespace std;
namespace scheduler {
class Lesson {
public:
Lesson();
Lesson(string subject_name, string lesson_type, string professor, string room);
Lesson(const Lesson &lesson) noexcept;
Lesson(Lesson &&lesson) noexcept;
virtual ~Lesson() = default;
Lesson &operator=(const Lesson &lesson) = default;
Lesson &operator=(Lesson &&lesson) = default;
const string &get_subject_name() const;
void set_subject_name(const string &subject_name);
const string &get_lesson_type() const;
void set_lesson_type(const string &lesson_type);
const string &get_professor() const;
void set_professor(const string &professor);
const string &get_room() const;
void set_room(const string &room);
const vector<string> &get_additions() const;
void set_additions(const vector<string> &additions);
void add_addition(const string &addition);
void add_additions(const vector<string> &additions);
string to_string(const string &intends = "\n\t") const;
friend ostream &operator<<(ostream &os, const Lesson &lesson);
private:
string _subject_name;
string _lesson_type;
string _professor;
string _room;
vector<string> _additions;
};
}
|
NikelWolf/mirea_schedule
|
include/WSchedule.h
|
<reponame>NikelWolf/mirea_schedule
#ifndef WSCHEDULE_H
#define WSCHEDULE_H
#include "WGroup.h"
class WSchedule : public QWidget {
Q_OBJECT
private:
vector<WGroup *> wgroups;
vector<GroupSchedule> &groupsVector;
private:
void createWidgets();
public:
explicit WSchedule(vector<GroupSchedule> &groupsVector_, QWidget *parent);
void saveSchedule();
void insertScheduleToDb();
signals:
public slots:
};
#endif // WSCHEDULE_H
|
NikelWolf/mirea_schedule
|
include/WGroup.h
|
#ifndef WGROUP_H
#define WGROUP_H
#include <WLesson.h>
#include <QtSql>
static const QSize hedSize[] = { //todo wgroup size
{30, h},
{140, h / 2},
{30, h / 2},
{40, h / 2},
{40, h / 2},
{30, h / 2},
{210, h / 2},
{40, h / 2},
{120, h / 2},
{55, h / 2},
{210, h / 2},
{160, h / 2},
{55, h / 2}
};
class WGroup : public QWidget {
Q_OBJECT
private:
QStringList headerLabels = {
{"Неделя"},
{"Группа"},
{"№ пары"},
{"Нач."},
{"Кон."},
{"Неделя"},
{"Предмет"},
{"Вид занятий"},
{"ФИО преподавателя"},
{"№ ауд."}
};
QStringList week = {
{"Пн"},
{"Вт"},
{"Ср"},
{"Чт"},
{"Пт"},
{"Сб"}
};
QVector<QStringList> lessonsTimeList = {
{" 9-00", "10-30"},
{"10-40", "12-10"},
{"13-00", "14-30"},
{"14-40", "16-10"},
{"16-20", "17-50"},
{"18-00", "19-30"},
};
QVBoxLayout *groupVerLayout;
array<QLabel *, 10> wlabels;
array<QLineEdit *, 3> wlineEdits;
vector<WLesson *> wlessons;
GroupSchedule &groupScheduleRef;
private:
void createWidgets();
public:
WGroup(GroupSchedule &groupSchedule_, QWidget *parent);
void saveGroup();
bool insertGroupToDb();
bool insertLessonToDb(QString &day, int lesson, int parity, WLesson *wLesson);
};
#endif // WGROUP_H
|
NikelWolf/mirea_schedule
|
include/WMain.h
|
#ifndef WMAIN_H
#define WMAIN_H
#include <QMainWindow>
#include <QScrollArea>
#include "WSchedule.h"
class WMain : public QMainWindow {
Q_OBJECT
private:
WSchedule *wschedule;
Scheduler& scheduler;
QScrollArea *scroll;
void createWidgets();
public:
WMain(Scheduler &scheduler_, QWidget *parent = nullptr);
signals:
public slots:
void openFile();
void saveFile();
void saveAsFile();
void checkSchedule();
};
#endif // WMAIN_H
|
NikelWolf/mirea_schedule
|
scheduler/include/schedule_error.h
|
#pragma once
#include "common.h"
namespace scheduler {
class ScheduleError : public runtime_error {
public:
explicit ScheduleError(const string &message);
explicit ScheduleError(const char *message);
};
}
|
katahiromz/WonAlphaBlend
|
WonAlphaBlend.h
|
#pragma once
#ifndef _INC_WINDOWS
#include <windows.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _WONBLENDFUNCTION {
BYTE BlendOp;
BYTE BlendFlags;
BYTE SourceConstantAlpha;
BYTE AlphaFormat;
} WONBLENDFUNCTION, *PWONBLENDFUNCTION;
#define WON_AC_SRC_OVER 0x00
#define WON_AC_SRC_ALPHA 0x01
BOOL APIENTRY
WonAlphaBlend(HDC hdc, INT x, INT y, INT cx, INT cy,
HDC hdcSrc, INT xSrc, INT ySrc, INT cxSrc, INT cySrc,
WONBLENDFUNCTION bf);
#if defined(_WONVER) && (_WONVER < 0x0500)
#define AlphaBlend WonAlphaBlend
#define GdiAlphaBlend WonAlphaBlend
#define AC_SRC_OVER WON_AC_SRC_OVER
#define AC_SRC_ALPHA WON_AC_SRC_ALPHA
#endif
#ifdef __cplusplus
} // extern "C"
#endif
|
katahiromz/WonAlphaBlend
|
WonAlphaBlend.c
|
<gh_stars>0
#include <windows.h>
#include "WonAlphaBlend.h"
BOOL APIENTRY
WonAlphaBlend(HDC hdc, INT x, INT y, INT cx, INT cy,
HDC hdcSrc, INT xSrc, INT ySrc, INT cxSrc, INT cySrc,
WONBLENDFUNCTION bf)
{
BITMAPINFO bi;
HBITMAP hbm, hbmSrc;
LPBYTE pbBits, pbBitsSrc;
LPBYTE pb, pbSrc;
HGDIOBJ hbmOld, hbmSrcOld;
HDC hdcMem, hdcMemSrc;
INT i;
BYTE b, g, r, a, alpha;
if (cx < 0 || cy < 0 || cxSrc < 0 || cySrc < 0)
return FALSE;
if (bf.BlendOp != WON_AC_SRC_OVER)
return FALSE;
if (bf.SourceConstantAlpha == 0)
return TRUE;
SetStretchBltMode(hdc, COLORONCOLOR);
if (bf.SourceConstantAlpha == 0xFF && bf.AlphaFormat == 0)
return StretchBlt(hdc, x, y, cx, cy,
hdcSrc, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
ZeroMemory(&bi.bmiHeader, sizeof(BITMAPINFOHEADER));
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = cx;
bi.bmiHeader.biHeight = cy;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
hbm = CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, (VOID **)&pbBits,
NULL, 0);
if (hbm != NULL)
{
hbmSrc = CreateDIBSection(NULL, &bi, DIB_RGB_COLORS,
(VOID **)&pbBitsSrc, NULL, 0);
if (hbmSrc != NULL)
{
hdcMem = CreateCompatibleDC(NULL);
if (hdcMem != NULL)
{
hdcMemSrc = CreateCompatibleDC(NULL);
if (hdcMemSrc != NULL)
{
goto success;
}
DeleteDC(hdcMem);
}
DeleteObject(hbmSrc);
}
DeleteObject(hbm);
}
return FALSE;
success:
SetStretchBltMode(hdcMem, COLORONCOLOR);
hbmOld = SelectObject(hdcMem, hbm);
BitBlt(hdcMem, 0, 0, cx, cy, hdc, x, y, SRCCOPY);
SetStretchBltMode(hdcMemSrc, COLORONCOLOR);
hbmSrcOld = SelectObject(hdcMemSrc, hbmSrc);
StretchBlt(hdcMemSrc, 0, 0, cx, cy,
hdcSrc, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
pb = pbBits;
pbSrc = pbBitsSrc;
if (bf.AlphaFormat == WON_AC_SRC_ALPHA)
{
if (bf.SourceConstantAlpha == 0xFF)
{
// SCA equals 0xFF
for(i = 0; i < cx * cy; i++)
{
a = pbSrc[3];
*pb++ = *pbSrc++ + ((UINT)(255 - a) * *pb) / 255;
*pb++ = *pbSrc++ + ((UINT)(255 - a) * *pb) / 255;
*pb++ = *pbSrc++ + ((UINT)(255 - a) * *pb) / 255;
*pb++ = *pbSrc++ + ((UINT)(255 - a) * *pb) / 255;
}
}
else
{
// the source has both the SCA and per-pixel alpha
for(i = 0; i < cx * cy; i++)
{
b = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
g = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
r = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
a = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
*pb++ = (UINT)b + (255 - a) * *pb / 255;
*pb++ = (UINT)g + (255 - a) * *pb / 255;
*pb++ = (UINT)r + (255 - a) * *pb / 255;
*pb++ = (UINT)a + (255 - a) * *pb / 255;
}
}
}
else
{
// AC_SRC_ALPHA is not set
for(i = 0; i < cx * cy; i++)
{
b = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
*pb++ = (UINT)b + (255 - bf.SourceConstantAlpha) * *pb / 255;
g = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
*pb++ = (UINT)g + (255 - bf.SourceConstantAlpha) * *pb / 255;
r = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
*pb++ = (UINT)r + (255 - bf.SourceConstantAlpha) * *pb / 255;
a = (UINT)*pbSrc++ * bf.SourceConstantAlpha / 255;
*pb++ = (UINT)a + (255 - bf.SourceConstantAlpha) * *pb / 255;
}
}
SelectObject(hdcMemSrc, hbmSrcOld);
DeleteObject(hbmSrc);
DeleteDC(hdcMemSrc);
BitBlt(hdc, x, y, cx, cy, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteObject(hbm);
DeleteDC(hdcMem);
return TRUE;
}
|
SuperrHaze/simple-ray-tracing
|
resource.h
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 RayTracing.rc 使用
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_RAY_TRACING_DIALOG 102
#define IDR_MAINFRAME 128
#define IDR_MENU1 129
#define IDB_BITMAP1 135
#define IDR_MENU2 139
#define IDR_MENU3 140
#define IDR_MENU4 141
#define IDR_MENU6 143
#define IDB_BITMAP3 147
#define IDB_BITMAP2 149
#define IDB_BITMAP4 150
#define IDB_BITMAP5 151
#define IDB_BITMAP6 152
#define IDI_ICON3 153
#define IDI_ICON4 154
#define IDI_ICON5 155
#define IDD_COMFIRM_CAM_OPEN 157
#define IDD_COMFIRM_OBJECT_OPEN 158
#define IDD_SA_PICTURE 161
#define IDR_MENU5 163
#define IDI_ICON1 165
#define IDI_ICON2 167
#define IDI_ICON6 168
#define IDI_ICON7 169
#define IDI_ICON8 170
#define IDI_ICON9 171
#define IDC_EDIT1 1000
#define IDC_EDIT2 1001
#define IDC_LIST1 1002
#define IDC_LIST2 1003
#define IDC_LIST3 1006
#define IDC_BUTTON_CALCULATE 1008
#define IDC_STATIC2 1010
#define IDC_BUTTON_COMFIRM_OBJ 1011
#define IDC_BUTTON_COMFIRM_CAM 1012
#define IDC_BUTTON_CANCEL_OBJ 1013
#define IDC_BUTTON_CANCEL_CAM 1014
#define IDC_DRAW_SA_BG 1015
#define IDC_MFCBUTTON1 1018
#define ID_32771 32771
#define ID_32772 32772
#define ID_32773 32773
#define ID_32774 32774
#define ID_32775 32775
#define ID_32776 32776
#define ID_32777 32777
#define ID_32778 32778
#define ID_32779 32779
#define ID_32780 32780
#define ID_32781 32781
#define ID_32782 32782
#define ID_32783 32783
#define ID_OPEN_ 32784
#define ID_OPEN_CAM_FACTOR_FILE 32785
#define ID_OPEN_OBJECT_FACTOR_FILE 32786
#define ID_SAVE_RESULT 32787
#define ID_EXIT 32788
#define ID_INPUT_CAM_FACTOR 32789
#define ID_INTPUT_OBJECT_FACTOR 32790
#define ID_32791 32791
#define ID_CALCULATE_RESULT 32792
#define ID_32793 32793
#define ID_DRAW_ 32794
#define ID_DRAW_SA_CURVE 32795
#define ID_USER_INSTRUCTION 32796
#define ID_ABOUT 32797
#define ID_32798 32798
#define ID_32799 32799
#define ID_32800 32800
#define ID_32801 32801
#define ID_32802 32802
#define ID_32803 32803
#define ID_32804 32804
#define ID_32805 32805
#define ID_SAVE_CAM_FACTOR 32806
#define ID_SAVE_OBJECT_FACTOR 32807
#define ID_INSERT_FRONT_SURFACE 32808
#define ID_INSERT_BEHIND_SURFACE 32809
#define ID_DELETE_SURFACE 32810
#define ID_COPY_ 32811
#define ID_INSERT_BACK_SURFACE 32812
#define ID_COPY_CELL 32813
#define ID_ 32814
#define ID_PASTE_CELL 32815
#define ID_INSERT_SURFACE 32816
#define ID_32817 32817
#define ID_32818 32818
#define ID_32821 32821
#define ID_32822 32822
#define ID_32823 32823
#define ID_32824 32824
#define ID_32825 32825
#define ID_32826 32826
#define ID_SET_INFINITY 32827
#define ID_SET_DISTANCE 32828
#define ID_COPY_CELL2 32829
#define ID_PASTE_CELL2 32830
#define ID_COPY_CELL3 32831
#define ID_PASTE_CELL3 32832
#define ID_32833 32833
#define ID_32834 32834
#define ID_UP_LINE 32835
#define ID_DOWN_LINE 32836
#define ID_32837 32837
#define ID_32838 32838
#define ID_QIUSHI_BLUE 32839
#define ID_GUANGDIAN_ORANGE 32840
#define ID_32841 32841
#define ID_32842 32842
#define ID_32843 32843
#define ID_32844 32844
#define ID_32845 32845
#define ID_BGC_WHITE 32846
#define ID_BGC_STAR 32847
#define ID_BGC_ 32848
#define ID_BGC_CHAGEBLUE 32849
#define ID_BGC_SLIGHTGREEN 32850
#define ID_32851 32851
#define ID_BGC_MARCLONE 32852
#define ID_BGC_macaron 32853
#define ID_32854 32854
#define ID_32855 32855
#define ID_32856 32856
#define ID_32857 32857
#define ID_32858 32858
#define ID_SA_SAVE_PICTURE 32859
#define ID_SAVE_PICTURE 32860
#define ID_SAVE_DATA 32861
#define ID_UPDATA_PICTURE 32862
#define ID_Draw_2D 32863
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 172
#define _APS_NEXT_COMMAND_VALUE 32864
#define _APS_NEXT_CONTROL_VALUE 1022
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|
SuperrHaze/simple-ray-tracing
|
aboutdlg.h
|
#pragma once
// aboutdlg 对话框
class aboutdlg : public CDialogEx
{
DECLARE_DYNAMIC(aboutdlg)
public:
aboutdlg(CWnd* pParent = nullptr); // 标准构造函数
virtual ~aboutdlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnAbout();
afx_msg void OnPasteCell3();
};
|
SuperrHaze/simple-ray-tracing
|
ComfirmObjOpen.h
|
#pragma once
// ComfirmObjOpen 对话框
class ComfirmObjOpen : public CDialogEx
{
DECLARE_DYNAMIC(ComfirmObjOpen)
public:
ComfirmObjOpen(CWnd* pParent = nullptr); // 标准构造函数
virtual ~ComfirmObjOpen();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_COMFIRM_OBJECT_OPEN };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButtonComfirmObj();
afx_msg void OnBnClickedButtonCancelObj();
};
|
SuperrHaze/simple-ray-tracing
|
SAPicture.h
|
<gh_stars>1-10
#pragma once
// SAPicture 对话框
class SAPicture : public CDialogEx
{
DECLARE_DYNAMIC(SAPicture)
public:
SAPicture(CWnd* pParent = nullptr); // 标准构造函数
virtual ~SAPicture();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_SA_PICTURE };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CMenu m_menu;
afx_msg void OnClose();
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
CStatic m_Paint;
void SADrawYaxis(CDC* Dc, CRect &rectPicture, CPen* pPen);
void SADrawXaxis(CDC* Dc, CRect &rectPicture, CPen* pPen, double Max);
void SADrawCurve(CDC* Dc, CRect& rectPicture, CPen* pPen, double* x, double* y, int size, double Max);
afx_msg void OnSavePicture();
afx_msg void OnSaveData();
afx_msg void OnUpdataPicture();
};
|
SuperrHaze/simple-ray-tracing
|
ComfirmCamOpen.h
|
#pragma once
// ComfirmCamOpen 对话框
class ComfirmCamOpen : public CDialogEx
{
DECLARE_DYNAMIC(ComfirmCamOpen)
public:
ComfirmCamOpen(CWnd* pParent = nullptr); // 标准构造函数
virtual ~ComfirmCamOpen();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_COMFIRM_CAM_OPEN };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnClose();
afx_msg void OnBnClickedButtonComfirmCam();
afx_msg void OnBnClickedButtonCancelCam();
};
|
SuperrHaze/simple-ray-tracing
|
ButtonTransparent.h
|
#pragma once
#include <afxwin.h>
class ButtonTransparent :
public CButton
{
public:
ButtonTransparent();
~ButtonTransparent();
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
// virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void PreSubclassWindow();
CBrush m_normalBrush;
CPen m_Pen;
CBrush m_activeBrush;
};
|
Loxe/CommonLib
|
RSTimingFunction.h
|
<filename>RSTimingFunction.h
//
// RSTimingFunction.h
//
// Created by <NAME> on 2013-09-28.
// This is free and unencumbered software released into the public domain.
//
#import <Foundation/Foundation.h>
// Common predefined timing functions
extern NSString * const kRSTimingFunctionLinear; // controlPoint1=(0, 0), controlPoint2=(1, 1)
extern NSString * const kRSTimingFunctionEaseIn; // controlPoint1=(0.42, 0), controlPoint2=(1, 1)
extern NSString * const kRSTimingFunctionEaseOut; // controlPoint1=(0, 0), controlPoint2=(0.58, 1)
extern NSString * const kRSTimingFunctionEaseInEaseOut; // controlPoint1=(0.42, 0), controlPoint2=(0.58, 1)
extern NSString * const kRSTimingFunctionDefault; // controlPoint1=(0.25, 0.1), controlPoint2=(0.25, 1)
//
// Like `CAMediaTimingFunction` but for versatile (animation) use: allows you to get the value for any given 'x' with `-valueForX:`.
// Any timing function maps an input value normalized to the interval [0..1] on the curve to an output value also in the interval [0..1].
// The implementation math is based on WebCore (WebKit), which is presumably what CoreAnimation is using under the hood too.
//
@interface RSTimingFunction : NSObject <NSCoding>
// Convenience methods to create a common timing function listed above
- (instancetype)initWithName:(NSString *)name;
+ (instancetype)timingFunctionWithName:(NSString *)name;
// Creates a timing function modelled on a cubic Bezier curve.
// The end points of the curve are at (0,0) and (1,1) and the two points defined by the class instance are its control points. Thus the points defining the Bezier curve are: '[(0,0), controlPoint1, controlPoint2, (1,1)]'
// Example: `RSTimingFunction *heavyEaseInTimingFunction = [RSTimingFunction timingFunctionWithControlPoint1:CGPointMake(0.8, 0.0) controlPoint2:CGPointMake(1.0, 1.0)];`
// [y]^ .---controlPoint2=(1,1)
// | |
// | .
// | ,
// | .
// |___.--'
// +-------.--->
// | [x]
// controlPoint1=(0.8,0)
// To visualize what curves given points will produce, use this great tool: http://netcetera.org/camtf-playground.html
- (instancetype)initWithControlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2;
+ (instancetype)timingFunctionWithControlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2;
// This is the meat and potatoes: returns `y` for a given `x` value.
- (CGFloat)valueForX:(CGFloat)x;
// If control points are changed after creation, returned values will reflect the changed curve immediately.
// It's more performant to use multiple timing functions with set control points instead of reusing one and changing its control points over and over.
@property (nonatomic, assign) CGPoint controlPoint1;
@property (nonatomic, assign) CGPoint controlPoint2;
// Optionally hint the duration to improve the precision of the values, e.g. when used for an animation.
// Shorter duration is more performant. Default is 1 second.
@property (nonatomic, assign) NSTimeInterval duration;
@end
|
j420247/ARO
|
5.0.0/ARO.Core/src/c/libimobiledevice-jni/libimobiledevice/lockdown.h
|
/**
* @file libimobiledevice/lockdown.h
* @brief Manage device preferences, start services, pairing and activation.
* \internal
*
* Copyright (c) 2008 <NAME>. All Rights Reserved.
* Copyright (c) 2009 <NAME>. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ILOCKDOWN_H
#define ILOCKDOWN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
/** @name Error Codes */
/*@{*/
#define LOCKDOWN_E_SUCCESS 0
#define LOCKDOWN_E_INVALID_ARG -1
#define LOCKDOWN_E_INVALID_CONF -2
#define LOCKDOWN_E_PLIST_ERROR -3
#define LOCKDOWN_E_PAIRING_FAILED -4
#define LOCKDOWN_E_SSL_ERROR -5
#define LOCKDOWN_E_DICT_ERROR -6
#define LOCKDOWN_E_START_SERVICE_FAILED -7
#define LOCKDOWN_E_NOT_ENOUGH_DATA -8
#define LOCKDOWN_E_SET_VALUE_PROHIBITED -9
#define LOCKDOWN_E_GET_VALUE_PROHIBITED -10
#define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11
#define LOCKDOWN_E_MUX_ERROR -12
#define LOCKDOWN_E_ACTIVATION_FAILED -13
#define LOCKDOWN_E_PASSWORD_PROTECTED -14
#define LOCKDOWN_E_NO_RUNNING_SESSION -15
#define LOCKDOWN_E_INVALID_HOST_ID -16
#define LOCKDOWN_E_INVALID_SERVICE -17
#define LOCKDOWN_E_INVALID_ACTIVATION_RECORD -18
#define LOCKDOWN_E_UNKNOWN_ERROR -256
/*@}*/
/** Represents an error code. */
typedef int16_t lockdownd_error_t;
typedef struct lockdownd_client_private lockdownd_client_private;
typedef lockdownd_client_private *lockdownd_client_t; /**< The client handle. */
struct lockdownd_pair_record {
char *device_certificate; /**< The device certificate */
char *host_certificate; /**< The host certificate */
char *host_id; /**< A unique HostID for the host computer */
char *root_certificate; /**< The root certificate */
};
/** A pair record holding device, host and root certificates along the host_id */
typedef struct lockdownd_pair_record *lockdownd_pair_record_t;
struct lockdownd_service_descriptor {
uint16_t port;
uint8_t ssl_enabled;
};
typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t;
/* Interface */
lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label);
lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label);
lockdownd_error_t lockdownd_client_free(lockdownd_client_t client);
lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type);
lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value);
lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value);
lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key);
lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service);
lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled);
lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id);
lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist);
lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist);
lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record);
lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client);
lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client);
lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client);
/* Helper */
void lockdownd_client_set_label(lockdownd_client_t client, const char *label);
lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t control, char **udid);
lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name);
lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count);
lockdownd_error_t lockdownd_data_classes_free(char **classes);
lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service);
#ifdef __cplusplus
}
#endif
#endif
|
j420247/ARO
|
4.1.1/c/AROCrypto_Win/crypto_openssl.h
|
<gh_stars>100-1000
#pragma once
#include "crypto_common.h"
BEGIN_NAMESPACE(CRYPTO)
enum crypto_cipher_alg {
CRYPTO_CIPHER_NULL = 0, CRYPTO_CIPHER_ALG_AES, CRYPTO_CIPHER_ALG_3DES,
CRYPTO_CIPHER_ALG_DES, CRYPTO_CIPHER_ALG_RC2, CRYPTO_CIPHER_ALG_RC4
};
/* CipherSuite */
#define TLS_NULL_WITH_NULL_NULL 0x0000 /* RFC 2246 */
#define TLS_RSA_WITH_NULL_MD5 0x0001 /* RFC 2246 */
#define TLS_RSA_WITH_NULL_SHA 0x0002 /* RFC 2246 */
#define TLS_RSA_EXPORT_WITH_RC4_40_MD5 0x0003 /* RFC 2246 */
#define TLS_RSA_WITH_RC4_128_MD5 0x0004 /* RFC 2246 */
#define TLS_RSA_WITH_RC4_128_SHA 0x0005 /* RFC 2246 */
#define TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 0x0006 /* RFC 2246 */
#define TLS_RSA_WITH_IDEA_CBC_SHA 0x0007 /* RFC 2246 */
#define TLS_RSA_EXPORT_WITH_DES40_CBC_SHA 0x0008 /* RFC 2246 */
#define TLS_RSA_WITH_DES_CBC_SHA 0x0009 /* RFC 2246 */
#define TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x000A /* RFC 2246 */
#define TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA 0x000B /* RFC 2246 */
#define TLS_DH_DSS_WITH_DES_CBC_SHA 0x000C /* RFC 2246 */
#define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA 0x000D /* RFC 2246 */
#define TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA 0x000E /* RFC 2246 */
#define TLS_DH_RSA_WITH_DES_CBC_SHA 0x000F /* RFC 2246 */
#define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA 0x0010 /* RFC 2246 */
#define TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA 0x0011 /* RFC 2246 */
#define TLS_DHE_DSS_WITH_DES_CBC_SHA 0x0012 /* RFC 2246 */
#define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 0x0013 /* RFC 2246 */
#define TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA 0x0014 /* RFC 2246 */
#define TLS_DHE_RSA_WITH_DES_CBC_SHA 0x0015 /* RFC 2246 */
#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x0016 /* RFC 2246 */
#define TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 0x0017 /* RFC 2246 */
#define TLS_DH_anon_WITH_RC4_128_MD5 0x0018 /* RFC 2246 */
#define TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA 0x0019 /* RFC 2246 */
#define TLS_DH_anon_WITH_DES_CBC_SHA 0x001A /* RFC 2246 */
#define TLS_DH_anon_WITH_3DES_EDE_CBC_SHA 0x001B /* RFC 2246 */
#define TLS_RSA_WITH_AES_128_CBC_SHA 0x002F /* RFC 3268 */
#define TLS_DH_DSS_WITH_AES_128_CBC_SHA 0x0030 /* RFC 3268 */
#define TLS_DH_RSA_WITH_AES_128_CBC_SHA 0x0031 /* RFC 3268 */
#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA 0x0032 /* RFC 3268 */
#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033 /* RFC 3268 */
#define TLS_DH_anon_WITH_AES_128_CBC_SHA 0x0034 /* RFC 3268 */
#define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035 /* RFC 3268 */
#define TLS_DH_DSS_WITH_AES_256_CBC_SHA 0x0036 /* RFC 3268 */
#define TLS_DH_RSA_WITH_AES_256_CBC_SHA 0x0037 /* RFC 3268 */
#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA 0x0038 /* RFC 3268 */
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039 /* RFC 3268 */
#define TLS_DH_anon_WITH_AES_256_CBC_SHA 0x003A /* RFC 3268 */
#define TLS_SEQ_NUM_LEN 8
typedef enum {
TLS_KEY_X_NULL,
TLS_KEY_X_RSA,
TLS_KEY_X_RSA_EXPORT,
TLS_KEY_X_DH_DSS_EXPORT,
TLS_KEY_X_DH_DSS,
TLS_KEY_X_DH_RSA_EXPORT,
TLS_KEY_X_DH_RSA,
TLS_KEY_X_DHE_DSS_EXPORT,
TLS_KEY_X_DHE_DSS,
TLS_KEY_X_DHE_RSA_EXPORT,
TLS_KEY_X_DHE_RSA,
TLS_KEY_X_DH_anon_EXPORT,
TLS_KEY_X_DH_anon
} tls_key_exchange;
typedef enum {
TLS_CIPHER_NULL,
TLS_CIPHER_RC4_40,
TLS_CIPHER_RC4_128,
TLS_CIPHER_RC2_CBC_40,
TLS_CIPHER_IDEA_CBC,
TLS_CIPHER_DES40_CBC,
TLS_CIPHER_DES_CBC,
TLS_CIPHER_3DES_EDE_CBC,
TLS_CIPHER_AES_128_CBC,
TLS_CIPHER_AES_256_CBC
} tls_cipher;
typedef enum {
TLS_HASH_NULL,
TLS_HASH_MD5,
TLS_HASH_SHA
} tls_hash;
enum crypto_hash_alg {
CRYPTO_HASH_ALG_MD5, CRYPTO_HASH_ALG_SHA1,
CRYPTO_HASH_ALG_HMAC_MD5, CRYPTO_HASH_ALG_HMAC_SHA1
};
struct tls_cipher_suite {
u16 suite;
tls_key_exchange key_exchange;
tls_cipher cipher;
tls_hash hash;
};
typedef enum {
TLS_CIPHER_STREAM,
TLS_CIPHER_BLOCK
} tls_cipher_type;
struct tls_cipher_data {
tls_cipher cipher;
tls_cipher_type type;
size_t key_material;
size_t expanded_key_material;
size_t block_size; /* also iv_size */
enum crypto_cipher_alg alg;
};
struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
const u8 *iv, const u8 *key,
size_t key_len);
int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt,
u8 *plain, size_t len);
void crypto_cipher_deinit(struct crypto_cipher *ctx);
const struct tls_cipher_data * tls_get_cipher_data(tls_cipher cipher);
const struct tls_cipher_suite * tls_get_cipher_suite(u16 suite);
struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
size_t key_len);
void crypto_hash_update(struct crypto_hash *ctx, const u8 *data, size_t len);
int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len);
END_NAMESPACE
|
j420247/ARO
|
5.0.0/ARO.Core/src/c/libimobiledevice-jni/ScreencaptureBridge.h
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_att_aro_libimobiledevice_ScreencaptureImpl */
#ifndef _Included_com_att_aro_libimobiledevice_ScreencaptureImpl
#define _Included_com_att_aro_libimobiledevice_ScreencaptureImpl
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_att_aro_libimobiledevice_ScreencaptureImpl
* Method: startService
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_att_aro_libimobiledevice_ScreencaptureImpl_startService
(JNIEnv *, jobject);
/*
* Class: com_att_aro_libimobiledevice_ScreencaptureImpl
* Method: captureScreen
* Signature: ()[B
*/
JNIEXPORT jbyteArray JNICALL Java_com_att_aro_libimobiledevice_ScreencaptureImpl_captureScreen
(JNIEnv *, jobject);
/*
* Class: com_att_aro_libimobiledevice_ScreencaptureImpl
* Method: stopService
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_att_aro_libimobiledevice_ScreencaptureImpl_stopService
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
|
j420247/ARO
|
5.0.0/ARO.Core/src/c/libimobiledevice-jni/libimobiledevice/afc.h
|
<reponame>j420247/ARO
/**
* @file libimobiledevice/afc.h
* @brief Access the filesystem.
* \internal
*
* Copyright (c) 2009 <NAME> All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IAFC_H
#define IAFC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
#define AFC_SERVICE_NAME "com.apple.afc"
/** @name Error Codes */
/*@{*/
#define AFC_E_SUCCESS 0
#define AFC_E_UNKNOWN_ERROR 1
#define AFC_E_OP_HEADER_INVALID 2
#define AFC_E_NO_RESOURCES 3
#define AFC_E_READ_ERROR 4
#define AFC_E_WRITE_ERROR 5
#define AFC_E_UNKNOWN_PACKET_TYPE 6
#define AFC_E_INVALID_ARG 7
#define AFC_E_OBJECT_NOT_FOUND 8
#define AFC_E_OBJECT_IS_DIR 9
#define AFC_E_PERM_DENIED 10
#define AFC_E_SERVICE_NOT_CONNECTED 11
#define AFC_E_OP_TIMEOUT 12
#define AFC_E_TOO_MUCH_DATA 13
#define AFC_E_END_OF_DATA 14
#define AFC_E_OP_NOT_SUPPORTED 15
#define AFC_E_OBJECT_EXISTS 16
#define AFC_E_OBJECT_BUSY 17
#define AFC_E_NO_SPACE_LEFT 18
#define AFC_E_OP_WOULD_BLOCK 19
#define AFC_E_IO_ERROR 20
#define AFC_E_OP_INTERRUPTED 21
#define AFC_E_OP_IN_PROGRESS 22
#define AFC_E_INTERNAL_ERROR 23
#define AFC_E_MUX_ERROR 30
#define AFC_E_NO_MEM 31
#define AFC_E_NOT_ENOUGH_DATA 32
#define AFC_E_DIR_NOT_EMPTY 33
/*@}*/
/** Represents an error code. */
typedef int16_t afc_error_t;
/** Flags for afc_file_open */
typedef enum {
AFC_FOPEN_RDONLY = 0x00000001, /**< r O_RDONLY */
AFC_FOPEN_RW = 0x00000002, /**< r+ O_RDWR | O_CREAT */
AFC_FOPEN_WRONLY = 0x00000003, /**< w O_WRONLY | O_CREAT | O_TRUNC */
AFC_FOPEN_WR = 0x00000004, /**< w+ O_RDWR | O_CREAT | O_TRUNC */
AFC_FOPEN_APPEND = 0x00000005, /**< a O_WRONLY | O_APPEND | O_CREAT */
AFC_FOPEN_RDAPPEND = 0x00000006 /**< a+ O_RDWR | O_APPEND | O_CREAT */
} afc_file_mode_t;
/** Type of link for afc_make_link() calls */
typedef enum {
AFC_HARDLINK = 1,
AFC_SYMLINK = 2
} afc_link_type_t;
/** Lock operation flags */
typedef enum {
AFC_LOCK_SH = 1 | 4, /**< shared lock */
AFC_LOCK_EX = 2 | 4, /**< exclusive lock */
AFC_LOCK_UN = 8 | 4 /**< unlock */
} afc_lock_op_t;
typedef struct afc_client_private afc_client_private;
typedef afc_client_private *afc_client_t; /**< The client handle. */
/* Interface */
afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t *client);
afc_error_t afc_client_start_service(idevice_t device, afc_client_t* client, const char* label);
afc_error_t afc_client_free(afc_client_t client);
afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list);
afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist);
afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle);
afc_error_t afc_file_close(afc_client_t client, uint64_t handle);
afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation);
afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read);
afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written);
afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence);
afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position);
afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize);
afc_error_t afc_remove_path(afc_client_t client, const char *path);
afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to);
afc_error_t afc_make_directory(afc_client_t client, const char *dir);
afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize);
afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);
afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime);
/* Helper functions */
afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value);
afc_error_t afc_dictionary_free(char **dictionary);
#ifdef __cplusplus
}
#endif
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.