VirtualBox

source: vbox/trunk/src/VBox/Storage/testcase/VDScriptInternal.h@ 80074

Last change on this file since 80074 was 76578, checked in by vboxsync, 6 years ago

Storage: scm --guard-relative-to-dir {parent}

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/** @file
2 *
3 * VBox HDD container test utility - scripting engine, internal script structures.
4 */
5
6/*
7 * Copyright (C) 2013-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.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
18#ifndef VBOX_INCLUDED_SRC_testcase_VDScriptInternal_h
19#define VBOX_INCLUDED_SRC_testcase_VDScriptInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/list.h>
25#include <iprt/string.h>
26
27#include "VDScript.h"
28
29/**
30 * Script function which can be called.
31 */
32typedef struct VDSCRIPTFN
33{
34 /** String space core. */
35 RTSTRSPACECORE Core;
36 /** Flag whether function is defined in the source or was
37 * registered from the outside. */
38 bool fExternal;
39 /** Flag dependent data. */
40 union
41 {
42 /** Data for functions defined in the source. */
43 struct
44 {
45 /** Pointer to the AST defining the function. */
46 PVDSCRIPTASTFN pAstFn;
47 } Internal;
48 /** Data for external defined functions. */
49 struct
50 {
51 /** Callback function. */
52 PFNVDSCRIPTCALLBACK pfnCallback;
53 /** Opaque user data. */
54 void *pvUser;
55 } External;
56 } Type;
57 /** Return type of the function. */
58 VDSCRIPTTYPE enmTypeRetn;
59 /** Number of arguments the function takes. */
60 unsigned cArgs;
61 /** Variable sized array of argument types. */
62 VDSCRIPTTYPE aenmArgTypes[1];
63} VDSCRIPTFN;
64/** Pointer to a script function registration structure. */
65typedef VDSCRIPTFN *PVDSCRIPTFN;
66
67/** Pointer to a tokenize state. */
68typedef struct VDTOKENIZER *PVDTOKENIZER;
69
70/**
71 * Script context.
72 */
73typedef struct VDSCRIPTCTXINT
74{
75 /** String space of external registered and source defined functions. */
76 RTSTRSPACE hStrSpaceFn;
77 /** List of ASTs for functions - VDSCRIPTASTFN. */
78 RTLISTANCHOR ListAst;
79 /** Pointer to the current tokenizer state. */
80 PVDTOKENIZER pTokenizer;
81} VDSCRIPTCTXINT;
82/** Pointer to a script context. */
83typedef VDSCRIPTCTXINT *PVDSCRIPTCTXINT;
84
85/**
86 * Check the context for type correctness.
87 *
88 * @returns VBox status code.
89 * @param pThis The script context.
90 */
91DECLHIDDEN(int) vdScriptCtxCheck(PVDSCRIPTCTXINT pThis);
92
93/**
94 * Interprete a given function AST. The executed functions
95 * must be type correct, otherwise the behavior is undefined
96 * (Will assert in debug builds).
97 *
98 * @returns VBox status code.
99 * @param pThis The script context.
100 * @param pszFn The function name to interprete.
101 * @param paArgs Arguments to pass to the function.
102 * @param cArgs Number of arguments.
103 * @param pRet Where to store the return value on success.
104 *
105 * @note: The AST is not modified in any way during the interpretation process.
106 */
107DECLHIDDEN(int) vdScriptCtxInterprete(PVDSCRIPTCTXINT pThis, const char *pszFn,
108 PVDSCRIPTARG paArgs, unsigned cArgs,
109 PVDSCRIPTARG pRet);
110
111#endif /* !VBOX_INCLUDED_SRC_testcase_VDScriptInternal_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