VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_header.py@ 68474

Last change on this file since 68474 was 63942, checked in by vboxsync, 8 years ago

OpenGL: fixed the most annoying coding style flaws, mainly removing spaces after '(' and before ')', no semantic change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6# This script generates the cr/include/cr_packfunctions.h file from the
7# gl_header.parsed file.
8
9from __future__ import print_function
10import sys
11import string
12
13import apiutil
14
15
16apiutil.CopyrightC()
17
18print("""#ifndef CR_PACKFUNCTIONS_H
19#define CR_PACKFUNCTIONS_H
20
21/* DO NOT EDIT - THIS FILE GENERATED BY THE pack_header.py SCRIPT */
22
23/* Prototypes for the OpenGL packer functions in packer.c and pack_bbox.c */
24
25#include "chromium.h"
26#include "state/cr_client.h"
27#include "cr_pack.h"
28
29#ifdef WINDOWS
30#define PACK_APIENTRY __stdcall
31#else
32#define PACK_APIENTRY
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38""")
39
40keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
41
42
43for func_name in keys:
44 if ("pack" in apiutil.ChromiumProps(func_name) or
45 "extpack" in apiutil.ChromiumProps(func_name) or
46 apiutil.NonVectorFunction(func_name) != '' or
47 apiutil.FindSpecial('packer', func_name)):
48
49 # OK, generate a crPackFooBar() prototype for this function
50 return_type = apiutil.ReturnType(func_name)
51 args = apiutil.Parameters(func_name)
52 if return_type != 'void':
53 if apiutil.IsPointer(return_type):
54 args.append(("return_value", return_type, 0))
55 else:
56 args.append(("return_value", return_type + "*", 0))
57 elif "pixelstore" in apiutil.Properties(func_name):
58 args.append(("packstate", "const CRPixelPackState *", 0))
59
60 if "get" in apiutil.Properties(func_name):
61 args.append(("writeback", "int *", 0))
62
63 print('void PACK_APIENTRY crPack%s(%s);' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args)))
64 print('void PACK_APIENTRY crPack%sSWAP(%s);' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args)))
65
66
67
68# Now generate special BBOX, COUNT, SWAP variations on the glVertex and
69# glVertexAttrib functions.
70for func_name in keys:
71 if (func_name[0:6] == "Vertex" and
72 "pervertex" in apiutil.Properties(func_name) and
73 ("pack" in apiutil.ChromiumProps(func_name) or
74 apiutil.NonVectorFunction(func_name) != '')):
75
76 assert apiutil.ReturnType(func_name) == "void"
77
78 args = apiutil.Parameters(func_name)
79 print('void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
80 print('void PACK_APIENTRY crPack%sBBOX_COUNT(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
81 print('void PACK_APIENTRY crPack%sBBOXSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
82 print('void PACK_APIENTRY crPack%sBBOX_COUNTSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
83
84
85print("""
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* CR_PACKFUNCTIONS_H */
91""")
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette