U ل=^4h � @ sH d dl Z d dlZd dlZddlmZ ddlmZ G dd� de�ZdZ dS )� N� )�model��VerificationErrorc @ s� e Zd ZdZdZdd� Zdd� Zdd� Zd d � ZdZdd �Z dd� Z d[dd�Zdd� Zdd� Z dd� Zdd� Zdd� ZeZeZeZdd� ZeZdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Z d5d6� Z!d7d8� Z"d9d:� Z#d\d=d>�Z$d?d@� Z%eZ&d]dAdB�Z'dCdD� Z(dEdF� Z)dGdH� Z*dIdJ� Z+d^dLdM�Z,d_dNdO�Z-dPdQ� Z.dRdS� Z/eZ0dTdU� Z1dVdW� Z2eZ3dXdY� Z4d;S )`�VGenericEngine�gFc C s || _ |j| _g | _i | _d S �N)�verifier�ffi�export_symbols�_struct_pending_verification)�selfr � r �/vengine_gen.py�__init__ s zVGenericEngine.__init__c C s |� d| j� d S )Nr )� setdefaultr )r �kwdsr r r �patch_extension_kwds s z#VGenericEngine.patch_extension_kwdsc C sT |D ]J}|| }|d krt j}|D ]*}tj�||�}tj�|�r"| S q"qd S r )�sys�path�os�join�isfile)r Zmodule_namer Zso_suffixesZ so_suffix�basename�dirname�filenamer r r �find_module s zVGenericEngine.find_modulec C s d S r r �r r r r � collect_types% s zVGenericEngine.collect_types� c C s | j �|d � d S )N� )Z_f�write)r Zwhatr r r �_prnt( s zVGenericEngine._prntc C s` | j }|t� || jj� | �d� tjdkr\tjdkr>d}nd}| j�� }|d||f � d S )NZdeclZwin32�� ZPyInit_Zinitzvoid %s%s(void) { } ) r"