cairo/src/win32
Andrea Canciani 1d3d64469f doc: Add "since" tag to documentation
The following Python script was used to compute "Since: 1.X" tags,
based on the first version where a symbol became officially supported.

This script requires a concatenation of the the cairo public headers
for the officially supported beckends to be available as
"../../includes/1.X.0.h".

from sys import argv
import re

syms = {}

def stripcomments(text):
    def replacer(match):
        s = match.group(0)
        if s.startswith('/'):
            return ""
        else:
            return s
    pattern = re.compile(
        r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
        re.DOTALL | re.MULTILINE
    )
    return re.sub(pattern, replacer, text)

for minor in range(12,-2,-2):
    version = "1.%d" % minor
    names = re.split('([A-Za-z0-9_]+)', stripcomments(open("../../includes/%s.0.h" % version).read()))
    for s in names: syms[s] = version

for filename in argv[1:]:
    is_public = False
    lines = open(filename, "r").read().split("\n")
    newlines = []
    for i in range(len(lines)):
        if lines[i] == "/**":
            last_sym = lines[i+1][2:].strip().replace(":", "")
            is_public = last_sym.lower().startswith("cairo")
        elif is_public and lines[i] == " **/":
            if last_sym in syms:
                v = syms[last_sym]
                if re.search("Since", newlines[-1]): newlines = newlines[:-1]
                if newlines[-1].strip() != "*": newlines.append(" *")
                newlines.append(" * Since: %s" % v)
            else:
                print "%s (%d): Cannot determine the version in which '%s' was introduced" % (filename, i, last_sym)
        newlines.append(lines[i])

    out = open(filename, "w")
    out.write("\n".join(newlines))
    out.close()
2012-03-29 11:03:18 +02:00
..
cairo-win32-debug.c win32: Rebase on the new compositor infrastructure 2012-02-15 14:37:11 +00:00
cairo-win32-device.c win32: Rebase on the new compositor infrastructure 2012-02-15 14:37:11 +00:00
cairo-win32-display-surface.c doc: Add "since" tag to documentation 2012-03-29 11:03:18 +02:00
cairo-win32-font.c doc: Add "since" tag to documentation 2012-03-29 11:03:18 +02:00
cairo-win32-gdi-compositor.c win32: Fix damage flushing 2012-03-21 20:09:52 +00:00
cairo-win32-printing-surface.c win32: Rebase on the new compositor infrastructure 2012-02-15 14:37:11 +00:00
cairo-win32-private.h win32: Rebase on the new compositor infrastructure 2012-02-15 14:37:11 +00:00
cairo-win32-surface.c doc: Add "since" tag to documentation 2012-03-29 11:03:18 +02:00
cairo-win32-system.c win32: Rebase on the new compositor infrastructure 2012-02-15 14:37:11 +00:00