VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py@ 21781

Last change on this file since 21781 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 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
6import sys
7
8import apiutil
9
10
11apiutil.CopyrightC()
12
13print """
14/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_retval.py SCRIPT */
15#include "chromium.h"
16#include "cr_mem.h"
17#include "cr_net.h"
18#include "server_dispatch.h"
19#include "server.h"
20
21void crServerReturnValue( const void *payload, unsigned int payload_len )
22{
23 CRMessageReadback *rb;
24 int msg_len = sizeof( *rb ) + payload_len;
25
26 /* Don't reply to client if we're loading VM snapshot*/
27 if (cr_server.bIsInLoadingState)
28 return;
29
30 if (cr_server.curClient->conn->type == CR_FILE)
31 {
32 return;
33 }
34
35 rb = (CRMessageReadback *) crAlloc( msg_len );
36
37 rb->header.type = CR_MESSAGE_READBACK;
38 crMemcpy( &(rb->writeback_ptr), &(cr_server.writeback_ptr), sizeof( rb->writeback_ptr ) );
39 crMemcpy( &(rb->readback_ptr), &(cr_server.return_ptr), sizeof( rb->readback_ptr ) );
40 crMemcpy( rb+1, payload, payload_len );
41 crNetSend( cr_server.curClient->conn, NULL, rb, msg_len );
42 crFree( rb );
43}
44"""
45
46keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
47
48for func_name in keys:
49 params = apiutil.Parameters(func_name)
50 return_type = apiutil.ReturnType(func_name)
51 if apiutil.FindSpecial( "server", func_name ):
52 continue
53 if return_type != 'void':
54 print '%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params))
55 print '{'
56 print '\t%s retval;' % return_type
57 print '\tretval = cr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) );
58 print '\tcrServerReturnValue( &retval, sizeof(retval) );'
59 print '\treturn retval; /* WILL PROBABLY BE IGNORED */'
60 print '}'
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