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 | import sys
|
---|
10 | import string
|
---|
11 |
|
---|
12 | import apiutil
|
---|
13 |
|
---|
14 |
|
---|
15 | apiutil.CopyrightC()
|
---|
16 |
|
---|
17 | print """#ifndef CR_PACKFUNCTIONS_H
|
---|
18 | #define CR_PACKFUNCTIONS_H
|
---|
19 |
|
---|
20 | /* DO NOT EDIT - THIS FILE GENERATED BY THE pack_header.py SCRIPT */
|
---|
21 |
|
---|
22 | /* Prototypes for the OpenGL packer functions in packer.c and pack_bbox.c */
|
---|
23 |
|
---|
24 | #include "chromium.h"
|
---|
25 | #include "state/cr_client.h"
|
---|
26 | #include "cr_pack.h"
|
---|
27 |
|
---|
28 | #ifdef WINDOWS
|
---|
29 | #define PACK_APIENTRY __stdcall
|
---|
30 | #else
|
---|
31 | #define PACK_APIENTRY
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifdef __cplusplus
|
---|
35 | extern "C" {
|
---|
36 | #endif
|
---|
37 | """
|
---|
38 |
|
---|
39 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
40 |
|
---|
41 |
|
---|
42 | for func_name in keys:
|
---|
43 | if ("pack" in apiutil.ChromiumProps(func_name) or
|
---|
44 | "extpack" in apiutil.ChromiumProps(func_name) or
|
---|
45 | apiutil.NonVectorFunction(func_name) != '' or
|
---|
46 | apiutil.FindSpecial('packer', func_name)):
|
---|
47 |
|
---|
48 | # OK, generate a crPackFooBar() prototype for this function
|
---|
49 | return_type = apiutil.ReturnType(func_name)
|
---|
50 | args = apiutil.Parameters(func_name)
|
---|
51 | if return_type != 'void':
|
---|
52 | if apiutil.IsPointer(return_type):
|
---|
53 | args.append(("return_value", return_type, 0))
|
---|
54 | else:
|
---|
55 | args.append(("return_value", return_type + "*", 0))
|
---|
56 | elif "pixelstore" in apiutil.Properties(func_name):
|
---|
57 | args.append(("packstate", "const CRPixelPackState *", 0))
|
---|
58 |
|
---|
59 | if "get" in apiutil.Properties(func_name):
|
---|
60 | args.append(("writeback", "int *", 0))
|
---|
61 |
|
---|
62 | print 'void PACK_APIENTRY crPack%s( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))
|
---|
63 | print 'void PACK_APIENTRY crPack%sSWAP( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))
|
---|
64 |
|
---|
65 |
|
---|
66 |
|
---|
67 | # Now generate special BBOX, COUNT, SWAP variations on the glVertex and
|
---|
68 | # glVertexAttrib functions.
|
---|
69 | for func_name in keys:
|
---|
70 | if (func_name[0:6] == "Vertex" and
|
---|
71 | "pervertex" in apiutil.Properties(func_name) and
|
---|
72 | ("pack" in apiutil.ChromiumProps(func_name) or
|
---|
73 | apiutil.NonVectorFunction(func_name) != '')):
|
---|
74 |
|
---|
75 | assert apiutil.ReturnType(func_name) == "void"
|
---|
76 |
|
---|
77 | args = apiutil.Parameters(func_name)
|
---|
78 | print 'void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args))
|
---|
79 | print 'void PACK_APIENTRY crPack%sBBOX_COUNT(%s);' % (func_name, apiutil.MakeDeclarationString(args))
|
---|
80 | print 'void PACK_APIENTRY crPack%sBBOXSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))
|
---|
81 | print 'void PACK_APIENTRY crPack%sBBOX_COUNTSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))
|
---|
82 |
|
---|
83 |
|
---|
84 | print """
|
---|
85 | #ifdef __cplusplus
|
---|
86 | }
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #endif /* CR_PACKFUNCTIONS_H */
|
---|
90 | """
|
---|