<reponame>sireliah/polish-python<filename>Objects/typeslots.py
#!/usr/bin/python
# coding: utf-8
# Usage: typeslots.py < Include/typeslots.h > typeslots.inc

zaimportuj sys, re

print("/* Generated by typeslots.py */")
res = {}
dla line w sys.stdin:
    m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
    jeżeli nie m:
        kontynuuj
    member = m.group(1)
    jeżeli member.startswith("tp_"):
        member = "ht_type."+member
    albo_inaczej member.startswith("am_"):
        member = "as_async."+member
    albo_inaczej member.startswith("nb_"):
        member = "as_number."+member
    albo_inaczej member.startswith("mp_"):
        member = "as_mapping."+member
    albo_inaczej member.startswith("sq_"):
        member = "as_sequence."+member
    albo_inaczej member.startswith("bf_"):
        member = "as_buffer."+member
    res[int(m.group(2))] = member

M = max(res.keys())+1
dla i w range(1,M):
    jeżeli i w res:
        print("offsetof(PyHeapTypeObject, %s)," % res[i])
    inaczej:
        print("0,")

#!/usr/bin/python
# coding: utf-8
# Usage: typeslots.py < Include/typeslots.h > typeslots.inc

zaimportuj sys, re

print("/* Generated by typeslots.py */")
res = {}
dla line w sys.stdin:
    m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
    jeżeli nie m:
        kontynuuj
    member = m.group(1)
    jeżeli member.startswith("tp_"):
        member = "ht_type."+member
    albo_inaczej member.startswith("am_"):
        member = "as_async."+member
    albo_inaczej member.startswith("nb_"):
        member = "as_number."+member
    albo_inaczej member.startswith("mp_"):
        member = "as_mapping."+member
    albo_inaczej member.startswith("sq_"):
        member = "as_sequence."+member
    albo_inaczej member.startswith("bf_"):
        member = "as_buffer."+member
    res[int(m.group(2))] = member

M = max(res.keys())+1
dla i w range(1,M):
    jeżeli i w res:
        print("offsetof(PyHeapTypeObject, %s)," % res[i])
    inaczej:
        print("0,")
#!/usr/bin/python # coding: utf-8 # Usage: typeslots.py < Include/typeslots.h > typeslots.inc