ScummVM API documentation
as_generic.h
1 /*
2  AngelCode Scripting Library
3  Copyright (c) 2003-2015 Andreas Jonsson
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any
7  damages arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any
10  purpose, including commercial applications, and to alter it and
11  redistribute it freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you
14  must not claim that you wrote the original software. If you use
15  this software in a product, an acknowledgment in the product
16  documentation would be appreciated but is not required.
17 
18  2. Altered source versions must be plainly marked as such, and
19  must not be misrepresented as being the original software.
20 
21  3. This notice may not be removed or altered from any source
22  distribution.
23 
24  The original version of this library can be located at:
25  http://www.angelcode.com/angelscript/
26 
27  Andreas Jonsson
28  andreas@angelcode.com
29 */
30 
31 
32 //
33 // as_generic.h
34 //
35 // This class handles the call to a function registered with asCALL_GENERIC
36 //
37 
38 
39 #ifndef AS_GENERIC_H
40 #define AS_GENERIC_H
41 
42 #include "as_config.h"
43 
44 BEGIN_AS_NAMESPACE
45 
46 class asCScriptEngine;
47 class asCScriptFunction;
48 
49 class asCGeneric : public asIScriptGeneric {
50 public:
51 //------------------------------
52 // asIScriptGeneric
53 //------------------------------
54  // Miscellaneous
55  asIScriptEngine *GetEngine() const;
56  asIScriptFunction *GetFunction() const;
57  void *GetAuxiliary() const;
58 
59  // Object
60  void *GetObject();
61  int GetObjectTypeId() const;
62 
63  // Arguments
64  int GetArgCount() const;
65  int GetArgTypeId(asUINT arg, asDWORD *flags = 0) const;
66  asBYTE GetArgByte(asUINT arg);
67  asWORD GetArgWord(asUINT arg);
68  asDWORD GetArgDWord(asUINT arg);
69  asQWORD GetArgQWord(asUINT arg);
70  float GetArgFloat(asUINT arg);
71  double GetArgDouble(asUINT arg);
72  void *GetArgAddress(asUINT arg);
73  void *GetArgObject(asUINT arg);
74  void *GetAddressOfArg(asUINT arg);
75 
76  // Return value
77  int GetReturnTypeId(asDWORD *flags = 0) const;
78  int SetReturnByte(asBYTE val);
79  int SetReturnWord(asWORD val);
80  int SetReturnDWord(asDWORD val);
81  int SetReturnQWord(asQWORD val);
82  int SetReturnFloat(float val);
83  int SetReturnDouble(double val);
84  int SetReturnAddress(void *addr);
85  int SetReturnObject(void *obj);
86  void *GetAddressOfReturnLocation();
87 
88 //------------------------
89 // internal
90 //-------------------------
91  asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer);
92  virtual ~asCGeneric();
93 
94  void *GetReturnPointer();
95 
96  asCScriptEngine *engine;
97  asCScriptFunction *sysFunction;
98  void *currentObject;
99  asDWORD *stackPointer;
100  void *objectRegister;
101 
102  asQWORD returnVal;
103 };
104 
105 END_AS_NAMESPACE
106 
107 #endif
Definition: angelscript.h:1083
Definition: as_generic.h:49
Definition: as_scriptfunction.h:146
Definition: angelscript.h:942
Definition: as_scriptengine.h:64
Definition: angelscript.h:639