blob: 5307f077e17dc92f1b7c05a344fd11a992ec0883 [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
Loganc4395232010-11-27 18:54:17 +080020#include "Compiler.h"
21
Logan3f3d31f2010-11-27 13:52:03 +080022#include <bcc/bcc.h>
Logan3f3d31f2010-11-27 13:52:03 +080023
24namespace bcc {
25
26 class BCCscript {
27 public:
28 //////////////////////////////////////////////////////////////////////////
29 // Part I. Compiler
30 //////////////////////////////////////////////////////////////////////////
31 Compiler compiler;
32
33 void registerSymbolCallback(BCCSymbolLookupFn pFn, BCCvoid *pContext) {
34 compiler.registerSymbolCallback(pFn, pContext);
35 }
36
37 //////////////////////////////////////////////////////////////////////////
38 // Part II. Logistics & Error handling
39 //////////////////////////////////////////////////////////////////////////
40 BCCscript() {
41 bccError = BCC_NO_ERROR;
42 }
43
44 ~BCCscript() {
45 }
46
47 void setError(BCCenum error) {
48 if (bccError == BCC_NO_ERROR && error != BCC_NO_ERROR) {
49 bccError = error;
50 }
51 }
52
53 BCCenum getError() {
54 BCCenum result = bccError;
55 bccError = BCC_NO_ERROR;
56 return result;
57 }
58
59 BCCenum bccError;
60 };
61
62} // namespace bcc
63
64#endif // BCC_SCRIPT_H