VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_current.py@ 63939

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

Build/scripts (bugref:6627): Python build scripts updated to generate the same code when used with Python 2 and 3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 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 pack_current.c file.
7
8from __future__ import print_function
9import sys
10sys.path.append( "../glapi_parser" )
11import apiutil
12
13from pack_currenttypes import *
14
15apiutil.CopyrightC()
16
17print("""
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
26void 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
40for 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}')
58print("""
59}
60
61void crPackNullCurrentPointers( void )
62{
63 CR_GET_PACKER_CONTEXT(pc);
64 CRCurrentStateAttr *c = &(pc->current.c);
65""")
66print('\tmemset ( c, 0, sizeof (CRCurrentStateAttr));')
67print("}")
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