VirtualBox

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

Last change on this file since 69390 was 69390, checked in by vboxsync, 7 years ago

HostServices/SharedOpenGL: scm updates

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