Commit d0162b7a authored by rsesek@chromium.org's avatar rsesek@chromium.org

generate_stubs: Allow // comments as well as the existing #.

BUG=none
TEST=generate_stubs_unittest.py
R=ajwong@chromium.org

Review URL: https://codereview.chromium.org/332823003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276925 0039d316-1c4b-4281-b951-d872f2087c98
parent 457861f9
# Copyright 2014 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. // found in the LICENSE file.
#------------------------------------------------ //------------------------------------------------
# Functions from libva used in chromium code. // Functions from libva used in chromium code.
#------------------------------------------------ //------------------------------------------------
VAStatus vaBeginPicture(VADisplay dpy, VAContextID context, VASurfaceID render_target); VAStatus vaBeginPicture(VADisplay dpy, VAContextID context, VASurfaceID render_target);
VAStatus vaCreateBuffer(VADisplay dpy, VAContextID context, VABufferType type, unsigned int size, unsigned int num_elements, void *data, VABufferID *buf_id); VAStatus vaCreateBuffer(VADisplay dpy, VAContextID context, VABufferType type, unsigned int size, unsigned int num_elements, void *data, VABufferID *buf_id);
VAStatus vaCreateConfig(VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id); VAStatus vaCreateConfig(VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id);
...@@ -31,8 +31,8 @@ VAStatus vaTerminate(VADisplay dpy); ...@@ -31,8 +31,8 @@ VAStatus vaTerminate(VADisplay dpy);
VAStatus vaUnmapBuffer(VADisplay dpy, VABufferID buf_id); VAStatus vaUnmapBuffer(VADisplay dpy, VABufferID buf_id);
#------------------------------------------------ //------------------------------------------------
# Functions from libva-x11 used in chromium code. // Functions from libva-x11 used in chromium code.
#------------------------------------------------ //------------------------------------------------
VADisplay vaGetDisplay(Display *dpy); VADisplay vaGetDisplay(Display *dpy);
VAStatus vaPutSurface(VADisplay dpy, VASurfaceID surface, Drawable draw, short srcx, short srcy, unsigned short srcw, unsigned short srch, short destx, short desty, unsigned short destw, unsigned short desth, VARectangle *cliprects, unsigned int number_cliprects, unsigned int flags); VAStatus vaPutSurface(VADisplay dpy, VASurfaceID surface, Drawable draw, short srcx, short srcy, unsigned short srcw, unsigned short srch, short destx, short desty, unsigned short destw, unsigned short desth, VARectangle *cliprects, unsigned int number_cliprects, unsigned int flags);
# Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. // found in the LICENSE file.
#------------------------------------------------ //------------------------------------------------
# Functions from pulse used in media code. // Functions from pulse used in media code.
#------------------------------------------------ //------------------------------------------------
pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop* m); pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop* m);
void pa_threaded_mainloop_free(pa_threaded_mainloop* m); void pa_threaded_mainloop_free(pa_threaded_mainloop* m);
pa_threaded_mainloop* pa_threaded_mainloop_new(); pa_threaded_mainloop* pa_threaded_mainloop_new();
......
...@@ -390,7 +390,7 @@ def ParseSignatures(infile): ...@@ -390,7 +390,7 @@ def ParseSignatures(infile):
The format of the input file is one C-style function signature per line, no The format of the input file is one C-style function signature per line, no
trailing semicolon. Empty lines are allowed. An empty line is a line that trailing semicolon. Empty lines are allowed. An empty line is a line that
consists purely of whitespace. Lines that begin with a # are considered consists purely of whitespace. Lines that begin with a # or // are considered
comment lines and are ignored. comment lines and are ignored.
We assume that "int foo(void)" is the same as "int foo()", which is not We assume that "int foo(void)" is the same as "int foo()", which is not
...@@ -411,7 +411,7 @@ def ParseSignatures(infile): ...@@ -411,7 +411,7 @@ def ParseSignatures(infile):
signatures = [] signatures = []
for line in infile: for line in infile:
line = line.strip() line = line.strip()
if line and line[0] != '#': if line and line[0] != '#' and line[0:2] != '//':
m = SIGNATURE_REGEX.match(line) m = SIGNATURE_REGEX.match(line)
if m is None: if m is None:
raise BadSignatureError('Unparsable line: %s' % line) raise BadSignatureError('Unparsable line: %s' % line)
......
...@@ -116,11 +116,15 @@ class GenerateStubModuleFunctionsUnittest(unittest.TestCase): ...@@ -116,11 +116,15 @@ class GenerateStubModuleFunctionsUnittest(unittest.TestCase):
my_sigs.append(SIMPLE_SIGNATURES[0][0]) my_sigs.append(SIMPLE_SIGNATURES[0][0])
my_sigs.append('# a third comment') my_sigs.append('# a third comment')
my_sigs.append(SIMPLE_SIGNATURES[0][0]) my_sigs.append(SIMPLE_SIGNATURES[0][0])
my_sigs.append('// a fourth comment')
my_sigs.append(SIMPLE_SIGNATURES[0][0])
my_sigs.append('//')
my_sigs.append(SIMPLE_SIGNATURES[0][0])
file_contents = '\n'.join(my_sigs) file_contents = '\n'.join(my_sigs)
infile = StringIO.StringIO(file_contents) infile = StringIO.StringIO(file_contents)
signatures = gs.ParseSignatures(infile) signatures = gs.ParseSignatures(infile)
self.assertEqual(3, len(signatures)) self.assertEqual(5, len(signatures))
class WindowsLibUnittest(unittest.TestCase): class WindowsLibUnittest(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment