1 | /* $Id: scriptbase.h 105755 2024-08-21 11:04:24Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - RTScript, Script language support in IPRT.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.alldomusa.eu.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___iprt_scriptbase_h
|
---|
28 | #define ___iprt_scriptbase_h
|
---|
29 |
|
---|
30 | #include <iprt/types.h>
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Position information.
|
---|
37 | */
|
---|
38 | typedef struct RTSCRIPTPOS
|
---|
39 | {
|
---|
40 | /** Line in the source. */
|
---|
41 | unsigned iLine;
|
---|
42 | /** Character index.*/
|
---|
43 | unsigned iCh;
|
---|
44 | } RTSCRIPTPOS;
|
---|
45 | /** Pointer to a source position. */
|
---|
46 | typedef struct RTSCRIPTPOS *PRTSCRIPTPOS;
|
---|
47 | /** Pointer to a constant source position. */
|
---|
48 | typedef const RTSCRIPTPOS *PCRTSCRIPTPOS;
|
---|
49 |
|
---|
50 |
|
---|
51 | #if 0 /* Later, maybe */
|
---|
52 | /**
|
---|
53 | * Native data types.
|
---|
54 | */
|
---|
55 | typedef enum RTSCRIPTNATIVETYPE
|
---|
56 | {
|
---|
57 | /** Invalid data type. */
|
---|
58 | RTSCRIPTNATIVETYPE_INVALID = 0,
|
---|
59 | /** Void type. */
|
---|
60 | RTSCRIPTNATIVETYPE_VOID = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 0),
|
---|
61 | /** Signed 8bit integer. */
|
---|
62 | RTSCRIPTNATIVETYPE_INT8 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 8),
|
---|
63 | /** Unsigned 8bit integer. */
|
---|
64 | RTSCRIPTNATIVETYPE_UINT8 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 8),
|
---|
65 | /** Signed 16bit integer. */
|
---|
66 | RTSCRIPTNATIVETYPE_INT16 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 16),
|
---|
67 | /** Unsigned 16bit integer. */
|
---|
68 | RTSCRIPTNATIVETYPE_UINT16 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 16),
|
---|
69 | /** Signed 32bit integer. */
|
---|
70 | RTSCRIPTNATIVETYPE_INT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 32),
|
---|
71 | /** Unsigned 32bit integer. */
|
---|
72 | RTSCRIPTNATIVETYPE_UINT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 32),
|
---|
73 | /** Signed 64bit integer. */
|
---|
74 | RTSCRIPTNATIVETYPE_INT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 64),
|
---|
75 | /** Unsigned 64bit integer. */
|
---|
76 | RTSCRIPTNATIVETYPE_UINT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 64),
|
---|
77 | /** 32bit floating point. */
|
---|
78 | RTSCRIPTNATIVETYPE_FLOAT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_FLOAT, 32),
|
---|
79 | /** 64bit floating point. */
|
---|
80 | RTSCRIPTNATIVETYPE_FLOAT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_FLOAT, 64),
|
---|
81 | /** Pointer type. */
|
---|
82 | RTSCRIPTNATIVETYPE_PTR = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_POINTER, 64),
|
---|
83 | /** 32bit hack. */
|
---|
84 | RTSCRIPTNATIVETYPE_32BIT_HACK = 0x7fffffff
|
---|
85 | } RTSCRIPTNATIVETYPE;
|
---|
86 |
|
---|
87 | #define RTSCRIPTNATIVETYPE_ENTRIES
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Data value.
|
---|
91 | */
|
---|
92 | typedef struct RTSCRIPTVAL
|
---|
93 | {
|
---|
94 | /** The value type. */
|
---|
95 | RTSCRIPTNATIVETYPE enmType;
|
---|
96 | /** Value, dependent on type. */
|
---|
97 | union
|
---|
98 | {
|
---|
99 | int8_t i8;
|
---|
100 | uint8_t u8;
|
---|
101 | int16_t i16;
|
---|
102 | uint16_t u16;
|
---|
103 | int32_t i32;
|
---|
104 | uint32_t u32;
|
---|
105 | int64_t i64;
|
---|
106 | uint64_t u64;
|
---|
107 | RTFLOAT64U r64;
|
---|
108 | } u;
|
---|
109 | } RTSCRIPTVAL;
|
---|
110 | /** Pointer to a value. */
|
---|
111 | typedef RTSCRIPTVAL *PRTSCRIPTVAL;
|
---|
112 | /** Pointer to a const value. */
|
---|
113 | typedef const RTSCRIPTVAL *PCRTSCRIPTVAL;
|
---|
114 | #endif
|
---|
115 |
|
---|
116 |
|
---|
117 | RT_C_DECLS_END
|
---|
118 |
|
---|
119 | #endif
|
---|