monotone

monotone Mtn Source Tree

Root/sqlite/vdbe.h

1/*
2** 2001 September 15
3**
4** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
6**
7** May you do good and not evil.
8** May you find forgiveness for yourself and forgive others.
9** May you share freely, never taking more than you give.
10**
11*************************************************************************
12** Header file for the Virtual DataBase Engine (VDBE)
13**
14** This header defines the interface to the virtual database engine
15** or VDBE. The VDBE implements an abstract machine that runs a
16** simple program to access and modify the underlying database.
17**
18** $Id: vdbe.h,v 1.1 2003/08/05 23:03:08 graydon Exp $
19*/
20#ifndef _SQLITE_VDBE_H_
21#define _SQLITE_VDBE_H_
22#include <stdio.h>
23
24/*
25** A single VDBE is an opaque structure named "Vdbe". Only routines
26** in the source file sqliteVdbe.c are allowed to see the insides
27** of this structure.
28*/
29typedef struct Vdbe Vdbe;
30
31/*
32** A single instruction of the virtual machine has an opcode
33** and as many as three operands. The instruction is recorded
34** as an instance of the following structure:
35*/
36struct VdbeOp {
37 int opcode; /* What operation to perform */
38 int p1; /* First operand */
39 int p2; /* Second parameter (often the jump destination) */
40 char *p3; /* Third parameter */
41 int p3type; /* P3_STATIC, P3_DYNAMIC or P3_POINTER */
42#ifdef VDBE_PROFILE
43 int cnt; /* Number of times this instruction was executed */
44 long long cycles; /* Total time spend executing this instruction */
45#endif
46};
47typedef struct VdbeOp VdbeOp;
48
49/*
50** Allowed values of VdbeOp.p3type
51*/
52#define P3_NOTUSED 0 /* The P3 parameter is not used */
53#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
54#define P3_STATIC (-2) /* Pointer to a static string */
55#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */
56
57/*
58** The following macro converts a relative address in the p2 field
59** of a VdbeOp structure into a negative number so that
60** sqliteVdbeAddOpList() knows that the address is relative. Calling
61** the macro again restores the address.
62*/
63#define ADDR(X) (-1-(X))
64
65/*
66** The makefile scans the vdbe.c source file and creates the "opcodes.h"
67** header file that defines a number for each opcode used by the VDBE.
68*/
69#include "opcodes.h"
70
71/*
72** Prototypes for the VDBE interface. See comments on the implementation
73** for a description of what each of these routines does.
74*/
75Vdbe *sqliteVdbeCreate(sqlite*);
76void sqliteVdbeCreateCallback(Vdbe*, int*);
77int sqliteVdbeAddOp(Vdbe*,int,int,int);
78int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOp const *aOp);
79void sqliteVdbeChangeP1(Vdbe*, int addr, int P1);
80void sqliteVdbeChangeP2(Vdbe*, int addr, int P2);
81void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
82void sqliteVdbeDequoteP3(Vdbe*, int addr);
83int sqliteVdbeFindOp(Vdbe*, int, int);
84VdbeOp *sqliteVdbeGetOp(Vdbe*, int);
85int sqliteVdbeMakeLabel(Vdbe*);
86void sqliteVdbeDelete(Vdbe*);
87void sqliteVdbeMakeReady(Vdbe*,sqlite_callback,void*,int);
88int sqliteVdbeExec(Vdbe*);
89int sqliteVdbeList(Vdbe*);
90int sqliteVdbeFinalize(Vdbe*,char**);
91void sqliteVdbeResolveLabel(Vdbe*, int);
92int sqliteVdbeCurrentAddr(Vdbe*);
93void sqliteVdbeTrace(Vdbe*,FILE*);
94void sqliteVdbeCompressSpace(Vdbe*,int);
95
96#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status