ngspicepy.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:ngspicepy 作者: ashwith 项目源码 文件源码
def SendChar(output, lib_id, ret_ptr):
    """Callback function that captures what's sent by ngspice to stdout."""
    global send_char_queue

    clean_output = "".join(output.decode().split('*'))
    if 'stdout' in clean_output:
        to_print = ' '.join(clean_output.split(' ')[1:]).strip()
        if "ngspice" in to_print and "done" in to_print:  # pragma: no cover
            send_char_queue.put("Quitting ngspice")
        elif "Note: 'quit' asks for detaching ngspice.dll"\
                in to_print:  # pragma: no cover
            pass
        elif to_print not in string.whitespace:
            send_char_queue.put(to_print)
    elif 'stderr' in clean_output:  # pragma: no cover
        if 'warning' not in clean_output.lower():
            raise SystemError(" ".join(clean_output.split(' ')[1:]))
        else:
            send_char_queue.put(clean_output)
    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号