Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: nacl_bindings_generator/generate_nacl_bindings.py

Issue 1052723003: NaCl: create a separate namespace for Mojo handles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Edits Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # pylint: disable=W0104,W0106,F0401,R0201 6 # pylint: disable=W0104,W0106,F0401,R0201
7 7
8 import errno 8 import errno
9 import os.path 9 import os.path
10 import sys 10 import sys
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if not impl.IsArray(): 359 if not impl.IsArray():
360 ConvertParam(code, impl) 360 ConvertParam(code, impl)
361 for impl in impls: 361 for impl in impls:
362 if impl.IsArray(): 362 if impl.IsArray():
363 ConvertParam(code, impl) 363 ConvertParam(code, impl)
364 code << '}' 364 code << '}'
365 code << '' 365 code << ''
366 366
367 # Call 367 # Call
368 getParams = [impl.CallParam() for impl in impls[:-1]] 368 getParams = [impl.CallParam() for impl in impls[:-1]]
369 code << 'result_value = %s(%s);' % (f.name, ', '.join(getParams)) 369 callTarget = f.name
370 # Redirect to namespaced functions.
371 if callTarget.startswith("Mojo"):
372 callTarget = callTarget[:4] + 'SystemImpl' + callTarget[4:]
373 getParams = ['g_mojo_system'] + getParams
374 code << 'result_value = %s(%s);' % (callTarget, ', '.join(getParams))
370 code << '' 375 code << ''
371 376
372 # Write outputs 377 # Write outputs
373 code << '{' 378 code << '{'
374 with code.Indent(): 379 with code.Indent():
375 code << 'ScopedCopyLock copy_lock(nap);' 380 code << 'ScopedCopyLock copy_lock(nap);'
376 for impl in impls: 381 for impl in impls:
377 impl.CopyOut(code) 382 impl.CopyOut(code)
378 code << '}' 383 code << '}'
379 code << '' 384 code << ''
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 GenerateMojoSyscall(mojo.functions, common_vars, out) 515 GenerateMojoSyscall(mojo.functions, common_vars, out)
511 516
512 out = OutFile(full_platform_dir, 'mojo_irt.h') 517 out = OutFile(full_platform_dir, 'mojo_irt.h')
513 GenerateMojoIrtHeader(mojo.functions, common_vars, out) 518 GenerateMojoIrtHeader(mojo.functions, common_vars, out)
514 519
515 out = OutFile(full_bindings_dir, 'mojo_irt.c') 520 out = OutFile(full_bindings_dir, 'mojo_irt.c')
516 GenerateMojoIrtImplementation(mojo.functions, common_vars, out) 521 GenerateMojoIrtImplementation(mojo.functions, common_vars, out)
517 522
518 if __name__ == '__main__': 523 if __name__ == '__main__':
519 main() 524 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698