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 pack_current.c file.
|
---|
7 |
|
---|
8 | from __future__ import print_function
|
---|
9 | import sys
|
---|
10 | sys.path.append( "../glapi_parser" )
|
---|
11 | import apiutil
|
---|
12 |
|
---|
13 | from pack_currenttypes import *
|
---|
14 |
|
---|
15 | apiutil.CopyrightC()
|
---|
16 |
|
---|
17 | print("""
|
---|
18 | /* DO NOT EDIT - THIS FILE GENERATED BY THE pack_current.py SCRIPT */
|
---|
19 |
|
---|
20 | #include <memory.h>
|
---|
21 | #include "packer.h"
|
---|
22 | #include "state/cr_currentpointers.h"
|
---|
23 |
|
---|
24 | #include <stdio.h>
|
---|
25 |
|
---|
26 | void crPackOffsetCurrentPointers( int offset )
|
---|
27 | {
|
---|
28 | CR_GET_PACKER_CONTEXT(pc);
|
---|
29 | GLnormal_p *normal = &(pc->current.c.normal);
|
---|
30 | GLcolor_p *color = &(pc->current.c.color);
|
---|
31 | GLsecondarycolor_p *secondaryColor = &(pc->current.c.secondaryColor);
|
---|
32 | GLtexcoord_p *texCoord = &(pc->current.c.texCoord);
|
---|
33 | GLindex_p *index = &(pc->current.c.index);
|
---|
34 | GLedgeflag_p *edgeFlag = &(pc->current.c.edgeFlag);
|
---|
35 | GLvertexattrib_p *vertexAttrib = &(pc->current.c.vertexAttrib);
|
---|
36 | GLfogcoord_p *fogCoord = &(pc->current.c.fogCoord);
|
---|
37 | int i;
|
---|
38 | """)
|
---|
39 |
|
---|
40 | for k in sorted(current_fns.keys()):
|
---|
41 | name = '%s%s' % (k[:1].lower(),k[1:])
|
---|
42 | if 'array' in current_fns[k]:
|
---|
43 | print('\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array'])
|
---|
44 | print('\t{')
|
---|
45 | for type in current_fns[k]['types']:
|
---|
46 | for size in current_fns[k]['sizes']:
|
---|
47 | indent = ""
|
---|
48 | ptr = "%s->%s%d" % (name, type, size )
|
---|
49 | if 'array' in current_fns[k]:
|
---|
50 | ptr += "[i]"
|
---|
51 | indent = "\t"
|
---|
52 | print("%s\tif ( %s )" % (indent, ptr))
|
---|
53 | print("%s\t{" % indent)
|
---|
54 | print("%s\t\t%s += offset;" % (indent, ptr ))
|
---|
55 | print("%s\t}" % indent)
|
---|
56 | if 'array' in current_fns[k]:
|
---|
57 | print('\t}')
|
---|
58 | print("""
|
---|
59 | }
|
---|
60 |
|
---|
61 | void crPackNullCurrentPointers( void )
|
---|
62 | {
|
---|
63 | CR_GET_PACKER_CONTEXT(pc);
|
---|
64 | CRCurrentStateAttr *c = &(pc->current.c);
|
---|
65 | """)
|
---|
66 | print('\tmemset ( c, 0, sizeof (CRCurrentStateAttr));')
|
---|
67 | print("}")
|
---|