1 /****************************************************************************
2  * Copyright (C) 2012 by Matteo Franchin                                    *
3  *                                                                          *
4  * This file is part of Box.                                                *
5  *                                                                          *
6  *   Box is free software: you can redistribute it and/or modify it         *
7  *   under the terms of the GNU Lesser General Public License as published  *
8  *   by the Free Software Foundation, either version 3 of the License, or   *
9  *   (at your option) any later version.                                    *
10  *                                                                          *
11  *   Box is distributed in the hope that it will be useful,                 *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
14  *   GNU Lesser General Public License for more details.                    *
15  *                                                                          *
16  *   You should have received a copy of the GNU Lesser General Public       *
17  *   License along with Box.  If not, see <http://www.gnu.org/licenses/>.   *
18  ****************************************************************************/
19 
20 /**
21  * @file vmproc_priv.h
22  * @brief The private header for the VM procedure module.
23  */
24 
25 #ifndef _BOX_VMPROC_PRIV_H
26 #  define _BOX_VMPROC_PRIV_H
27 
28 #  include <stdlib.h>
29 #  include <stdio.h>
30 
31 #  include <box/occupation.h>
32 #  include <box/vm.h>
33 #  include <box/srcpos.h>
34 #  include <box/callable.h>
35 #  include <box/vmproc.h>
36 
37 /**
38  * @brief Implementation of #BoxVMProcTable;
39  */
40 struct BoxVMProcTable_struct {
41   BoxUInt
42     target_proc_num,       /**< Number of the target procedure */
43     tmp_proc;              /**< Procedure used as temporary buffer */
44   BoxVMProc *target_proc;  /**< The target procedure */
45   BoxArr installed;        /**< Array of the installed procedures */
46   BoxOcc uninstalled;      /**< Array of the uninstalled procedures */
47 };
48 
49 /**
50  * @brief Implementation of #BoxVMProcInstalled.
51  */
52 struct BoxVMProcInstalled_struct {
53   BoxVMProcKind type;     /**< Kind of procedure */
54   char          *name;    /**< Symbol-name of the procedure */
55   char          *desc;    /**< Description of the procedure */
56   union {
57     BoxCallable *foreign; /**< Foreign callable. */
58     BoxCCallOld c;        /**< Pointer to the C function (can't use
59                                BoxCCallOld!) */
60     BoxVMCallNum proc_id; /**< Number of the procedure which contains
61                                the code */
62   } code;
63 };
64 
65 #endif /* _BOX_VMPROC_PRIV_H */
66