Edit File: func_call.cpython-36.pyc
3 �e� � @ s0 d dl mZ G dd� de�ZG dd� de�ZdS )� )�FunctionArgumentc @ s e Zd ZdZd dd�ZdS ) �FunctionCallOptionsz> Options to format a function call and its arguments. FT�, � c C s. || _ || _|| _|| _|| _|| _d| _d S )NF)� write_address�write_types� write_argname�replace_socketcall�string_max_length�max_array_countZ instr_pointer)�selfr r r r r r � r �9/tmp/pip-build-uv1wutoy/python-ptrace/ptrace/func_call.py�__init__ s zFunctionCallOptions.__init__N)FFTr Fr )�__name__� __module__�__qualname__�__doc__r r r r r r s r c @ sF e Zd ZdZefdd�Zddd�Zdd� Zd d � Zdd� Z d d� Z dS )�FunctionCalla� A function call. Attributes: - name (str): function name - arguments: list of FunctionArgument objects - restype (str, optional): result type - resvalue (optional): result value - argument_class: class used to build the new arguments Methods: - format(): create a string representation of the call - addArgument(): add a new argument - clearArguments(): remove all arguments c C s( || _ || _g | _d | _d | _|| _d S )N)�name�options� arguments�restypeZresvalue�argument_class)r r r r r r r r % s zFunctionCall.__init__Nc C s, | j | t| j�| j|||�}| jj|� d S )N)r �lenr r �append)r �valuer �type�argr r r �addArgument- s zFunctionCall.addArgumentc C s g | _ d S )N)r )r r r r �clearArguments2 s zFunctionCall.clearArgumentsc C sH t |t�r:x| jD ]}|j|kr|S qW td| |f ��n | j| S d S )Nz%r has no argument called %r)� isinstance�strr r �KeyError)r �keyr r r r �__getitem__5 s zFunctionCall.__getitem__c C sj dd� | j D �}x|r,|d r,|jd� qW dj|�}| jrX| jjrXd| j| j|f S d| j|f S d S ) Nc S s g | ]}|j � �qS r )�format)�.0r r r r � <listcomp>@ s z'FunctionCall.format.<locals>.<listcomp>� z, z %s %s(%s)z%s(%s)���r* )r �pop�joinr r r r )r r r r r r&