diff options
author | Andrea Canciani <ranma42@gmail.com> | 2012-03-27 11:48:19 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2012-03-29 11:03:18 +0200 |
commit | 1d3d64469f3ddac282860f66b24a35cf2253fa46 (patch) | |
tree | b9547d1352d4afbab644a618c70785f6d754a524 /src/cairo-png.c | |
parent | 79740139e05375c4ce3542b571bc6a1e9d9137a7 (diff) | |
download | cairo-1d3d64469f3ddac282860f66b24a35cf2253fa46.tar.gz |
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()
Diffstat (limited to 'src/cairo-png.c')
-rw-r--r-- | src/cairo-png.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cairo-png.c b/src/cairo-png.c index b36c8df44..e74a4a8bc 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -70,6 +70,8 @@ * Defined if the PNG functions are available. * This macro can be used to conditionally compile code using the cairo * PNG functions. + * + * Since: 1.0 **/ struct png_read_closure_t { @@ -348,6 +350,8 @@ stdio_write_func (png_structp png, png_bytep data, png_size_t size) * %CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have * pixel contents, or %CAIRO_STATUS_WRITE_ERROR if an I/O error occurs * while attempting to write the file. + * + * Since: 1.0 **/ cairo_status_t cairo_surface_write_to_png (cairo_surface_t *surface, @@ -414,6 +418,8 @@ stream_write_func (png_structp png, png_bytep data, png_size_t size) * memory could not be allocated for the operation, * %CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have * pixel contents. + * + * Since: 1.0 **/ cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t *surface, @@ -742,6 +748,8 @@ read_png (struct png_read_closure_t *png_closure) * Alternatively, you can allow errors to propagate through the drawing * operations and check the status on the context upon completion * using cairo_status(). + * + * Since: 1.0 **/ cairo_surface_t * cairo_image_surface_create_from_png (const char *filename) @@ -795,6 +803,8 @@ cairo_image_surface_create_from_png (const char *filename) * Alternatively, you can allow errors to propagate through the drawing * operations and check the status on the context upon completion * using cairo_status(). + * + * Since: 1.0 **/ cairo_surface_t * cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, |