VirtualBox

source: vbox/trunk/include/iprt/scriptbase.h@ 106967

Last change on this file since 106967 was 105757, checked in by vboxsync, 3 months ago

Runtime/script: Add a simple lexer API to turn a stream of characters into tokens for a defined configuration, bugref:10394 [scm]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/* $Id: scriptbase.h 105757 2024-08-21 11:42:13Z vboxsync $ */
2/** @file
3 * IPRT - RTScript, Script language support in IPRT.
4 */
5
6/*
7 * Copyright (C) 2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef IPRT_INCLUDED_scriptbase_h
38#define IPRT_INCLUDED_scriptbase_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <iprt/types.h>
44
45RT_C_DECLS_BEGIN
46
47
48/**
49 * Position information.
50 */
51typedef struct RTSCRIPTPOS
52{
53 /** Line in the source. */
54 unsigned iLine;
55 /** Character index.*/
56 unsigned iCh;
57} RTSCRIPTPOS;
58/** Pointer to a source position. */
59typedef struct RTSCRIPTPOS *PRTSCRIPTPOS;
60/** Pointer to a constant source position. */
61typedef const RTSCRIPTPOS *PCRTSCRIPTPOS;
62
63
64#if 0 /* Later, maybe */
65/**
66 * Native data types.
67 */
68typedef enum RTSCRIPTNATIVETYPE
69{
70 /** Invalid data type. */
71 RTSCRIPTNATIVETYPE_INVALID = 0,
72 /** Void type. */
73 RTSCRIPTNATIVETYPE_VOID = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 0),
74 /** Signed 8bit integer. */
75 RTSCRIPTNATIVETYPE_INT8 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 8),
76 /** Unsigned 8bit integer. */
77 RTSCRIPTNATIVETYPE_UINT8 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 8),
78 /** Signed 16bit integer. */
79 RTSCRIPTNATIVETYPE_INT16 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 16),
80 /** Unsigned 16bit integer. */
81 RTSCRIPTNATIVETYPE_UINT16 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 16),
82 /** Signed 32bit integer. */
83 RTSCRIPTNATIVETYPE_INT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 32),
84 /** Unsigned 32bit integer. */
85 RTSCRIPTNATIVETYPE_UINT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 32),
86 /** Signed 64bit integer. */
87 RTSCRIPTNATIVETYPE_INT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 64),
88 /** Unsigned 64bit integer. */
89 RTSCRIPTNATIVETYPE_UINT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_INTEGER, 64),
90 /** 32bit floating point. */
91 RTSCRIPTNATIVETYPE_FLOAT32 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_FLOAT, 32),
92 /** 64bit floating point. */
93 RTSCRIPTNATIVETYPE_FLOAT64 = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_SIGNED, RTSCRIPTNATIVETYPE_CLASS_FLOAT, 64),
94 /** Pointer type. */
95 RTSCRIPTNATIVETYPE_PTR = RTSCRIPTNATIVETYPE_ASSEMBLE(RTSCRIPTNATIVETYPE_UNSIGNED, RTSCRIPTNATIVETYPE_CLASS_POINTER, 64),
96 /** 32bit hack. */
97 RTSCRIPTNATIVETYPE_32BIT_HACK = 0x7fffffff
98} RTSCRIPTNATIVETYPE;
99
100#define RTSCRIPTNATIVETYPE_ENTRIES
101
102/**
103 * Data value.
104 */
105typedef struct RTSCRIPTVAL
106{
107 /** The value type. */
108 RTSCRIPTNATIVETYPE enmType;
109 /** Value, dependent on type. */
110 union
111 {
112 int8_t i8;
113 uint8_t u8;
114 int16_t i16;
115 uint16_t u16;
116 int32_t i32;
117 uint32_t u32;
118 int64_t i64;
119 uint64_t u64;
120 RTFLOAT64U r64;
121 } u;
122} RTSCRIPTVAL;
123/** Pointer to a value. */
124typedef RTSCRIPTVAL *PRTSCRIPTVAL;
125/** Pointer to a const value. */
126typedef const RTSCRIPTVAL *PCRTSCRIPTVAL;
127#endif
128
129
130RT_C_DECLS_END
131
132#endif /* !IPRT_INCLUDED_scriptbase_h */
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