U ل=^2� � @ s@ d dl Z d dlZddlmZ ddlmZ G dd� de�ZdZdS )� N� )�model��VerificationErrorc @ s e Zd ZdZdZdd� Zdd� Zdd� Zd d � Zdndd �Z dd� Z dd� Zdd� Zdodd�Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� ZeZeZeZeZeZd)d*� Zd+d,� Zd-d.� ZeZd/d0� Z eZ!d1d2� Z"d3d4� Z#d5d6� Z$d7d8� Z%eZ&d9d:� Z'd;d<� Z(d=d>� Z)d?d@� Z*dAdB� Z+dCdD� Z,dEdF� Z-dGdH� Z.eZ/dIdJ� Z0dKdL� Z1dMdN� Z2dOdP� Z3dpdSdT�Z4dUdV� Z5dWdX� Z6eZ7eZ8eZ9dqdYdZ�Z:d[d\� Z;drd^d_�Z<eZ=eZ>d`da� Z?dbdc� Z@ddde� ZAeZBeZCeZDeZEdfdg� ZFdhdi� ZGeZHeZIdjdk� ZJdldm� ZKdS )s�VCPythonEngine�xTc C s || _ |j| _i | _i | _d S �N)�verifier�ffi�_struct_pending_verification�_types_of_builtin_functions)�selfr � r �/vengine_cpy.py�__init__ s zVCPythonEngine.__init__c C s d S r r )r �kwdsr r r �patch_extension_kwds s z#VCPythonEngine.patch_extension_kwdsc C sR zt �||�\}}}W n tk r, Y d S X |d k r>|�� |d |krNd S |S �Nr )�imp�find_module�ImportError�close)r Zmodule_name�pathZso_suffixes�f�filenameZdescrr r r r s zVCPythonEngine.find_modulec C s i | _ | �d� d S )NZcollecttype)� _typesdict� _generate�r r r r � collect_types$ s zVCPythonEngine.collect_types� c C s | j �|d � d S )N� )Z_f�write)r Zwhatr r r �_prnt( s zVCPythonEngine._prntc C s | j | S r )r )r �typer r r �_gettypenum+ s zVCPythonEngine._gettypenumc C s8 t |tj�r|jdkr4|| jkr4t| j�}|| j|<