CXString.odin (2654B)
1 /*===-- clang-c/CXString.h - C Index strings --------------------*- C -*-===*\ 2 |* *| 3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 4 |* Exceptions. *| 5 |* See https://llvm.org/LICENSE.txt for license information. *| 6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 7 |* *| 8 |*===----------------------------------------------------------------------===*| 9 |* *| 10 |* This header provides the interface to C Index strings. *| 11 |* *| 12 \*===----------------------------------------------------------------------===*/ 13 package libclang 14 15 import "core:c" 16 17 _ :: c 18 19 when ODIN_OS == .Windows { 20 @(extra_linker_flags="/NODEFAULTLIB:libcmt") 21 foreign import lib { 22 "system:ntdll.lib", 23 "system:ucrt.lib", 24 "system:msvcrt.lib", 25 "system:legacy_stdio_definitions.lib", 26 "system:kernel32.lib", 27 "system:user32.lib", 28 "system:advapi32.lib", 29 "system:shell32.lib", 30 "system:ole32.lib", 31 "system:oleaut32.lib", 32 "system:uuid.lib", 33 "system:ws2_32.lib", 34 "system:version.lib", 35 "system:oldnames.lib", 36 "libclang.lib", 37 } 38 } else { 39 foreign import lib "system:clang" 40 } 41 42 // LLVM_CLANG_C_CXSTRING_H :: 43 44 /** 45 * A character string. 46 * 47 * The \c CXString type is used to return strings from the interface when 48 * the ownership of that string might differ from one call to the next. 49 * Use \c clang_getCString() to retrieve the string data and, once finished 50 * with the string data, call \c clang_disposeString() to free the string. 51 */ 52 String :: struct { 53 data: rawptr, 54 private_flags: c.uint, 55 } 56 57 String_Set :: struct { 58 Strings: ^String, 59 Count: c.uint, 60 } 61 62 @(default_calling_convention="c", link_prefix="clang_") 63 foreign lib { 64 /** 65 * Retrieve the character data associated with the given string. 66 * 67 * The returned data is a reference and not owned by the user. This data 68 * is only valid while the `CXString` is valid. This function is similar 69 * to `std::string::c_str()`. 70 */ 71 getCString :: proc(_string: String) -> cstring --- 72 73 /** 74 * Free the given string. 75 */ 76 disposeString :: proc(_string: String) --- 77 78 /** 79 * Free the given string set. 80 */ 81 disposeStringSet :: proc(set: ^String_Set) --- 82 }