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 |
|
---|
9 | from __future__ import print_function
|
---|
10 | import sys
|
---|
11 | import string
|
---|
12 |
|
---|
13 | import apiutil
|
---|
14 |
|
---|
15 |
|
---|
16 | apiutil.CopyrightC()
|
---|
17 |
|
---|
18 | print("""#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
|
---|
36 | extern "C" {
|
---|
37 | #endif
|
---|
38 | """)
|
---|
39 |
|
---|
40 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
41 |
|
---|
42 |
|
---|
43 | for 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.
|
---|
70 | for 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 |
|
---|
85 | print("""
|
---|
86 | #ifdef __cplusplus
|
---|
87 | }
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #endif /* CR_PACKFUNCTIONS_H */
|
---|
91 | """)
|
---|