Logan | 3f3d31f | 2010-11-27 13:52:03 +0800 | [diff] [blame] | 1 | /* |
| 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 | |
Logan | c439523 | 2010-11-27 18:54:17 +0800 | [diff] [blame] | 20 | #include "Compiler.h" |
| 21 | |
Logan | 3f3d31f | 2010-11-27 13:52:03 +0800 | [diff] [blame] | 22 | #include <bcc/bcc.h> |
Logan | 3f3d31f | 2010-11-27 13:52:03 +0800 | [diff] [blame] | 23 | |
| 24 | namespace 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 |