VDScriptInterp.cpp revision fb7c7050d4e425a33a74936d12390d522666aa6c
/** @file
*
* VBox HDD container test utility - scripting engine, interpreter.
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#define LOGGROUP LOGGROUP_DEFAULT
#include "VDScriptAst.h"
#include "VDScriptInternal.h"
/**
* Block scope.
*/
typedef struct VDSCRIPTINTERPSCOPE
{
/** Pointer to the enclosing scope if available. */
struct VDSCRIPTINTERPSCOPE *pParent;
/** String space of accessible variables. */
/** Pointer to a scope block. */
typedef VDSCRIPTINTERPSCOPE *PVDSCRIPTINTERPSCOPE;
/**
* Function call.
*/
typedef struct VDSCRIPTINTERPFNCALL
{
/** Pointer to the caller of this function. */
struct VDSCRIPTINTERPFNCALL *pCaller;
/** Root scope of this function. */
/** Current scope in this function. */
/** Pointer to a function call. */
typedef VDSCRIPTINTERPFNCALL *PVDSCRIPTINTERPFNCALL;
/**
* Interpreter context.
*/
typedef struct VDSCRIPTINTERPCTX
{
/** Current function call entry. */
/** Stack of calculated values. */
/** Number of values on the stack. */
unsigned cValuesOnStack;
/** Maximum number of values the stack can hold currently. */
unsigned cValuesOnStackMax;
/** Stack of executed AST nodes. */
/** Number of AST nodes on the stack. */
unsigned cAstNodesOnStack;
/** Maximum number of AST nodes the stack can hold. */
unsigned cAstNodesOnStackMax;
/** Pointer to an interpreter context. */
typedef VDSCRIPTINTERPCTX *PVDSCRIPTINTERPCTX;
/**
* Record an error while interpreting.
*
* @returns VBox status code passed.
* @param pThis The script context.
* @param rc The status code to record.
* @param RT_SRC_POS Position in the source code.
* @param pszFmt Format string.
*/
static int vdScriptInterpreterError(PVDSCRIPTCTXINT pThis, int rc, RT_SRC_POS_DECL, const char *pszFmt, ...)
{
return rc;
}
{
return VERR_NOT_IMPLEMENTED;
}