0
|
1 /*
|
|
2
|
|
3 Package: dyncall
|
|
4 Library: dyncall
|
|
5 File: dyncall/dyncall_struct.h
|
|
6 Description: C interface to compute struct size
|
|
7 License:
|
|
8
|
|
9 Copyright (c) 2010-2015 Olivier Chafik <olivier.chafik@centraliens.net>
|
|
10
|
|
11 Permission to use, copy, modify, and distribute this software for any
|
|
12 purpose with or without fee is hereby granted, provided that the above
|
|
13 copyright notice and this permission notice appear in all copies.
|
|
14
|
|
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
|
23 */
|
|
24
|
|
25
|
|
26
|
|
27 /*
|
|
28
|
|
29 dyncall struct metadata structures
|
|
30
|
|
31 REVISION
|
|
32 2007/12/11 initial
|
|
33
|
|
34 */
|
|
35
|
|
36 #ifndef DYNCALL_STRUCT_H
|
|
37 #define DYNCALL_STRUCT_H
|
|
38
|
|
39 #include "dyncall.h"
|
|
40
|
|
41 #ifdef __cplusplus
|
|
42 extern "C" {
|
|
43 #endif
|
|
44
|
|
45 typedef struct DCfield_ {
|
|
46 DCsize offset, size, alignment, arrayLength;
|
|
47 DCint type;
|
|
48 DCstruct* pSubStruct;
|
|
49 } DCfield;
|
|
50
|
|
51 struct DCstruct_ {
|
|
52 DCfield *pFields;
|
|
53 DCsize size, alignment, fieldCount;
|
|
54
|
|
55 /* struct building uses a state machine. */
|
|
56 DCint nextField; /* == -1 if struct is closed */
|
|
57 DCstruct *pCurrentStruct, *pLastStruct; /* == this, unless we're in a sub struct */
|
|
58 };
|
|
59
|
|
60
|
|
61 /* Helper. */
|
|
62 void dcArgStructUnroll(DCCallVM* vm, DCstruct* s, DCpointer value);
|
|
63
|
|
64
|
|
65 #ifdef __cplusplus
|
|
66 }
|
|
67 #endif
|
|
68
|
|
69 #endif /* DYNCALL_H */
|
|
70
|