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