Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
dtmuller | 052abc3 | 2016-07-26 11:58:28 +0200 | [diff] [blame] | 20 | #include "thrift/common.h" |
| 21 | #include "thrift/parse/t_base_type.h" |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 22 | |
| 23 | t_type* g_type_void; |
| 24 | t_type* g_type_string; |
| 25 | t_type* g_type_binary; |
Jens Geyer | 62445c1 | 2022-06-29 00:00:00 +0200 | [diff] [blame] | 26 | t_type* g_type_uuid; |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 27 | t_type* g_type_bool; |
| 28 | t_type* g_type_i8; |
| 29 | t_type* g_type_i16; |
| 30 | t_type* g_type_i32; |
| 31 | t_type* g_type_i64; |
| 32 | t_type* g_type_double; |
| 33 | |
| 34 | void initGlobals() { |
| 35 | g_type_void = new t_base_type("void", t_base_type::TYPE_VOID); |
| 36 | g_type_string = new t_base_type("string", t_base_type::TYPE_STRING); |
| 37 | g_type_binary = new t_base_type("string", t_base_type::TYPE_STRING); |
| 38 | ((t_base_type*)g_type_binary)->set_binary(true); |
Jens Geyer | 62445c1 | 2022-06-29 00:00:00 +0200 | [diff] [blame] | 39 | g_type_uuid = new t_base_type("string", t_base_type::TYPE_UUID); |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 40 | g_type_bool = new t_base_type("bool", t_base_type::TYPE_BOOL); |
| 41 | g_type_i8 = new t_base_type("i8", t_base_type::TYPE_I8); |
| 42 | g_type_i16 = new t_base_type("i16", t_base_type::TYPE_I16); |
| 43 | g_type_i32 = new t_base_type("i32", t_base_type::TYPE_I32); |
| 44 | g_type_i64 = new t_base_type("i64", t_base_type::TYPE_I64); |
| 45 | g_type_double = new t_base_type("double", t_base_type::TYPE_DOUBLE); |
| 46 | } |
| 47 | |
| 48 | void clearGlobals() { |
| 49 | delete g_type_void; |
| 50 | delete g_type_string; |
Jens Geyer | 62445c1 | 2022-06-29 00:00:00 +0200 | [diff] [blame] | 51 | delete g_type_binary; |
| 52 | delete g_type_uuid; |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 53 | delete g_type_bool; |
| 54 | delete g_type_i8; |
| 55 | delete g_type_i16; |
| 56 | delete g_type_i32; |
| 57 | delete g_type_i64; |
| 58 | delete g_type_double; |
| 59 | } |
| 60 | |
| 61 | /** |
Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 62 | * The location of the last parsed doctext comment. |
| 63 | */ |
| 64 | int g_doctext_lineno; |
| 65 | int g_program_doctext_lineno = 0; |
| 66 | PROGDOCTEXT_STATUS g_program_doctext_status = INVALID; |