blob: 5798b822eb0a2bb53ee78e92e9b5d357c9f3e32b [file] [log] [blame]
Logan3f3d31f2010-11-27 13:52:03 +08001/*
2 * Copyright 2010, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef BCC_SCRIPT_H
18#define BCC_SCRIPT_H
19
20#include <bcc/bcc.h>
21#include "bcc_compiler.h"
22
23namespace bcc {
24
25 class BCCscript {
26 public:
27 //////////////////////////////////////////////////////////////////////////
28 // Part I. Compiler
29 //////////////////////////////////////////////////////////////////////////
30 Compiler compiler;
31
32 void registerSymbolCallback(BCCSymbolLookupFn pFn, BCCvoid *pContext) {
33 compiler.registerSymbolCallback(pFn, pContext);
34 }
35
36 //////////////////////////////////////////////////////////////////////////
37 // Part II. Logistics & Error handling
38 //////////////////////////////////////////////////////////////////////////
39 BCCscript() {
40 bccError = BCC_NO_ERROR;
41 }
42
43 ~BCCscript() {
44 }
45
46 void setError(BCCenum error) {
47 if (bccError == BCC_NO_ERROR && error != BCC_NO_ERROR) {
48 bccError = error;
49 }
50 }
51
52 BCCenum getError() {
53 BCCenum result = bccError;
54 bccError = BCC_NO_ERROR;
55 return result;
56 }
57
58 BCCenum bccError;
59 };
60
61} // namespace bcc
62
63#endif // BCC_SCRIPT_H